expressions.sql 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. -- current_time / localtime
  10. SELECT now()::timetz::text = current_time::text;
  11. SELECT now()::timetz(4)::text = current_time(4)::text;
  12. -- current_timestamp / localtimestamp (always matches because of transactional behaviour)
  13. SELECT current_timestamp = NOW();
  14. -- precision
  15. SELECT length(current_timestamp::text) >= length(current_timestamp(0)::text);
  16. -- current_role/user/user is tested in rolnames.sql
  17. -- current database / catalog
  18. SELECT current_catalog = current_database();
  19. -- current_schema
  20. SELECT current_schema;
  21. SET search_path = 'pg_catalog';
  22. SELECT current_schema;
  23. --
  24. -- Test parsing of a no-op cast to a type with unspecified typmod
  25. --
  26. begin;
  27. create table numeric_tbl (f1 numeric(18,3), f2 numeric);
  28. -- bpchar, lacking planner support for its length coercion function,
  29. -- could behave differently
  30. create table bpchar_tbl (f1 character(16) unique, f2 bpchar);
  31. rollback;
  32. --
  33. -- Tests for ScalarArrayOpExpr with a hashfn
  34. --
  35. -- create a stable function so that the tests below are not
  36. -- evaluated using the planner's constant folding.
  37. begin;
  38. rollback;
  39. -- Test with non-strict equality function.
  40. -- We need to create our own type for this.
  41. begin;
  42. create table inttest (a myint);
  43. rollback;