构造线段,点,线,范围
postgres=# select proname,pg_get_function_arguments(oid) parameter,pg_get_function_result(oid) result,prosrc from pg_proc where prosrc ~ 'construct';
proname | parameter | result | prosrc
-----------+----------------------------------------------------------------+-----------+--------------------
lseg | point, point | lseg | lseg_construct
point | double precision, double precision | point | construct_point
line | point, point | line | line_construct_pp
int4range | integer, integer | int4range | range_constructor2
int4range | integer, integer, text | int4range | range_constructor3
numrange | numeric, numeric | numrange | range_constructor2
numrange | numeric, numeric, text | numrange | range_constructor3
tsrange | timestamp without time zone, timestamp without time zone | tsrange | range_constructor2
tsrange | timestamp without time zone, timestamp without time zone, text | tsrange | range_constructor3
tstzrange | timestamp with time zone, timestamp with time zone | tstzrange | range_constructor2
tstzrange | timestamp with time zone, timestamp with time zone, text | tstzrange | range_constructor3
daterange | date, date | daterange | range_constructor2
daterange | date, date, text | daterange | range_constructor3
int8range | bigint, bigint | int8range | range_constructor2
int8range | bigint, bigint, text | int8range | range_constructor3
(15 rows)
构造数组
postgres=# select array[1,2,3];
array
---------
{1,2,3}
(1 row)
构造record
postgres=# select row(1,2,'ab');
row
----------
(1,2,ab)
(1 row)
构造表
postgres=# select * from ( values (1,2,'2014-01-01'),(1,2,'2014-01-01'),(1,2,'2014-01-01') ) as t(c1,c2,c3);
c1 | c2 | c3
----+----+------------
1 | 2 | 2014-01-01
1 | 2 | 2014-01-01
1 | 2 | 2014-01-01
(3 rows)