Type of text literals
Type of text literals
От:
Steve Baldwin <steve.baldwin@gmail.com>
Дата:
Can someone please help me understand this:
b2bc_dev=# select pg_typeof('a') as a, pg_typeof(array['a']) as arr;
a | arr
---------+--------
unknown | text[]
(1 row)
Why is a text literal on its own 'unknown' whereas in the context of an array it assumes 'text' ?
This is pg 10.4 in case it matters.
Thanks,
Steve
Re: Type of text literals
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Steve Baldwin writes:
> Can someone please help me understand this:
> b2bc_dev=# select pg_typeof('a') as a, pg_typeof(array['a']) as arr;
> a | arr
> ---------+--------
> unknown | text[]
> (1 row)
> Why is a text literal on its own 'unknown' whereas in the context of an
> array it assumes 'text' ?
There is no "unknown[]" type, so it has to assume something.
regards, tom lane