Обсуждение: confused by int2vector typdelim
hi.
select
pt.typtype
, pt.typcategory
, pt.typdelim
, pt.typelem
, pt1.typname as elem_type
,pt.typsubscript
,pt.typname
from pg_type pt join pg_type pt1 on pt.typelem = pt1.oid
where pt.typname = 'int2vector';
returns
typtype | typcategory | typdelim | typelem | elem_type | typsubscript | typname
---------+-------------+---------+----------+-----------+-------------------------+------------
b | A | , | 21 | int2 | array_subscript_handler | int2vector
(1 row)
pt.typtype
, pt.typcategory
, pt.typdelim
, pt.typelem
, pt1.typname as elem_type
,pt.typsubscript
,pt.typname
from pg_type pt join pg_type pt1 on pt.typelem = pt1.oid
where pt.typname = 'int2vector';
returns
typtype | typcategory | typdelim | typelem | elem_type | typsubscript | typname
---------+-------------+---------+----------+-----------+-------------------------+------------
b | A | , | 21 | int2 | array_subscript_handler | int2vector
(1 row)
from manual:
typdelimcharCharacter that separates two values of this type when parsing array input. Note that the delimiter is associated with the array element data type, not the array data type.
should I expect the typdelim be a white space? Since '1 2'::int2vector works, '1,2'::int2vector does not work.
jian he <jian.universality@gmail.com> writes:
> should I expect the typdelim be a white space? Since '1 2'::int2vector
> works, '1,2'::int2vector does not work.
typdelim applies to the type's associated array type, that is
int2vector[].
regression=# select '{1 2,3 4 5}'::int2vector[];
int2vector
-----------------
{"1 2","3 4 5"}
(1 row)
regards, tom lane