From: Tom Lane <tgl@sss.pgh.pa.us>
To: Scott Ribe <scott_ribe@elevated-dev.com>
Cc: Postgresql General <pgsql-general@postgresql.org>
Subject: Re: different empty array syntax requirements
Date: Thu, 21 Apr 2016 22:37:53 -0400
Message-ID: <14071.1461292673@sss.pgh.pa.us> (raw)
In-Reply-To: <ED37E303-1B0A-4CD8-8E1E-B9C4C2DD9A17@elevated-dev.com>
References: <ED37E303-1B0A-4CD8-8E1E-B9C4C2DD9A17@elevated-dev.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Scott Ribe <scott_ribe@elevated-dev.com> 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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, scott_ribe@elevated-dev.com
Subject: Re: different empty array syntax requirements
In-Reply-To: <14071.1461292673@sss.pgh.pa.us>
References: <ED37E303-1B0A-4CD8-8E1E-B9C4C2DD9A17@elevated-dev.com> <14071.1461292673@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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