expressions.out 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --
  2. -- expression evaluation tests that don't fit into a more specific file
  3. --
  4. --
  5. -- Tests for SQLVAlueFunction
  6. --
  7. -- current_date (always matches because of transactional behaviour)
  8. SELECT date(now())::text = current_date::text;
  9. ?column?
  10. ----------
  11. t
  12. (1 row)
  13. -- current_time / localtime
  14. SELECT now()::timetz::text = current_time::text;
  15. ?column?
  16. ----------
  17. t
  18. (1 row)
  19. SELECT now()::timetz(4)::text = current_time(4)::text;
  20. ?column?
  21. ----------
  22. t
  23. (1 row)
  24. -- current_timestamp / localtimestamp (always matches because of transactional behaviour)
  25. SELECT current_timestamp = NOW();
  26. ?column?
  27. ----------
  28. t
  29. (1 row)
  30. -- precision
  31. SELECT length(current_timestamp::text) >= length(current_timestamp(0)::text);
  32. ?column?
  33. ----------
  34. t
  35. (1 row)
  36. -- current_role/user/user is tested in rolnames.sql
  37. -- current database / catalog
  38. SELECT current_catalog = current_database();
  39. ?column?
  40. ----------
  41. t
  42. (1 row)
  43. -- current_schema
  44. SELECT current_schema;
  45. current_schema
  46. ----------------
  47. public
  48. (1 row)
  49. SET search_path = 'pg_catalog';
  50. SELECT current_schema;
  51. current_schema
  52. ----------------
  53. pg_catalog
  54. (1 row)
  55. --
  56. -- Test parsing of a no-op cast to a type with unspecified typmod
  57. --
  58. begin;
  59. create table numeric_tbl (f1 numeric(18,3), f2 numeric);
  60. -- bpchar, lacking planner support for its length coercion function,
  61. -- could behave differently
  62. create table bpchar_tbl (f1 character(16) unique, f2 bpchar);
  63. rollback;
  64. --
  65. -- Tests for ScalarArrayOpExpr with a hashfn
  66. --
  67. -- create a stable function so that the tests below are not
  68. -- evaluated using the planner's constant folding.
  69. begin;
  70. rollback;
  71. -- Test with non-strict equality function.
  72. -- We need to create our own type for this.
  73. begin;
  74. create table inttest (a myint);
  75. rollback;