1--
2-- expression evaluated tests that don't fit into a more specific file
3--
4
5--
6-- Tests for SQLVAlueFunction
7--
8
9
10-- current_date  (always matches because of transactional behaviour)
11SELECT date(now())::text = current_date::text;
12
13
14-- current_time / localtime
15SELECT now()::timetz::text = current_time::text;
16SELECT now()::time::text = localtime::text;
17
18-- current_timestamp / localtimestamp (always matches because of transactional behaviour)
19SELECT current_timestamp = NOW();
20-- precision
21SELECT length(current_timestamp::text) >= length(current_timestamp(0)::text);
22-- localtimestamp
23SELECT now()::timestamp::text = localtimestamp::text;
24
25-- current_role/user/user is tested in rolnames.sql
26
27-- current database / catalog
28SELECT current_catalog = current_database();
29
30-- current_schema
31SELECT current_schema;
32SET search_path = 'notme';
33SELECT current_schema;
34SET search_path = 'pg_catalog';
35SELECT current_schema;
36RESET search_path;
37
38
39--
40-- Test parsing of a no-op cast to a type with unspecified typmod
41--
42begin;
43
44create table numeric_tbl (f1 numeric(18,3), f2 numeric);
45
46create view numeric_view as
47  select
48    f1, f1::numeric(16,4) as f1164, f1::numeric as f1n,
49    f2, f2::numeric(16,4) as f2164, f2::numeric as f2n
50  from numeric_tbl;
51
52\d+ numeric_view
53
54explain (verbose, costs off) select * from numeric_view;
55
56rollback;
57