Search Postgresql Archives

Re: different empty array syntax requirements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Scott Ribe <scott_ribe@xxxxxxxxxxxxxxxx> writes:
> How is that one pgsql build (both are 9.5.2) has different casting behavior for empty arrays:
> pedcard=# select (ARRAY[])::text[];
> ERROR:  cannot determine type of empty array
> LINE 1: select (ARRAY[])::text[];
>                 ^
> HINT:  Explicitly cast to the desired type, for example ARRAY[]::integer[].

... wtf?

[ thinks for awhile ... ]

Oh!  I bet this explains it:

regression=#  select (ARRAY[])::text[];
 array 
-------
 {}
(1 row)

regression=# set operator_precedence_warning = on;
SET
regression=#  select (ARRAY[])::text[];
ERROR:  cannot determine type of empty array
LINE 1: select (ARRAY[])::text[];
                ^
HINT:  Explicitly cast to the desired type, for example ARRAY[]::integer[].


The parens turn into an actual parsetree node when
operator_precedence_warning is on, and the cast-of-an-array hack doesn't
know it should look through such a node.  That's a bug.  Will fix it.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux