pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
confused by int2vector typdelim
2+ messages / 2 participants
[nested] [flat]

* confused by int2vector typdelim
@ 2023-05-24 07:56 jian he <jian.universality@gmail.com>
  2023-05-24 14:09 ` Re: confused by int2vector typdelim Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: jian he @ 2023-05-24 07:56 UTC (permalink / raw)
  To: pgsql-general list <pgsql-general@lists.postgresql.org>

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)

from manual:

> typdelim char
> Character 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.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: confused by int2vector typdelim
  2023-05-24 07:56 confused by int2vector typdelim jian he <jian.universality@gmail.com>
@ 2023-05-24 14:09 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2023-05-24 14:09 UTC (permalink / raw)
  To: jian he <jian.universality@gmail.com>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-05-24 14:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 07:56 confused by int2vector typdelim jian he <jian.universality@gmail.com>
2023-05-24 14:09 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox