pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feeddifferent empty array syntax requirements
5+ messages / 3 participants
[nested] [flat]
* different empty array syntax requirements
@ 2016-04-22 02:20 Scott Ribe <scott_ribe@elevated-dev.com>
0 siblings, 2 replies; 5+ messages in thread
From: Scott Ribe @ 2016-04-22 02:20 UTC (permalink / raw)
To: pgsql-general
How is that one pgsql build (both are 9.5.2) has different casting behavior for empty arrays:
ericmj=# select ARRAY[]::text[];
array
-------
{}
(1 row)
ericmj=# select (ARRAY[])::text[];
array
-------
{}
(1 row)
--VS--
pedcard=# select ARRAY[]::text[];
array
-------
{}
(1 row)
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[].
--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: different empty array syntax requirements
@ 2016-04-22 02:25 Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>
parent: Scott Ribe <scott_ribe@elevated-dev.com>
1 sibling, 1 reply; 5+ messages in thread
From: Alvaro Aguayo Garcia-Rada @ 2016-04-22 02:25 UTC (permalink / raw)
To: pgsql-general; Scott Ribe <scott_ribe@elevated-dev.com>
Looks like one has the appropiate cast operator, while the other hasn't. Have you tried doing the same, on both server, on an empty database created from template0?
Regards,
Alvaro Aguayo
Jefe de Operaciones
Open Comb Systems E.I.R.L.
Oficina: (+51-1) 3377813 | RPM: #034252 / (+51) 995540103 | RPC: (+51) 954183248
Website: www.ocs.pe
Sent from my Sony Xperia™ smartphone
---- Scott Ribe wrote ----
How is that one pgsql build (both are 9.5.2) has different casting behavior for empty arrays:
ericmj=# select ARRAY[]::text[];
array
-------
{}
(1 row)
ericmj=# select (ARRAY[])::text[];
array
-------
{}
(1 row)
--VS--
pedcard=# select ARRAY[]::text[];
array
-------
{}
(1 row)
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[].
--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: different empty array syntax requirements
@ 2016-04-22 02:37 Tom Lane <tgl@sss.pgh.pa.us>
parent: Scott Ribe <scott_ribe@elevated-dev.com>
1 sibling, 1 reply; 5+ messages in thread
From: Tom Lane @ 2016-04-22 02:37 UTC (permalink / raw)
To: Scott Ribe <scott_ribe@elevated-dev.com>; +Cc: pgsql-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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: different empty array syntax requirements
@ 2016-04-22 11:13 Scott Ribe <scott_ribe@elevated-dev.com>
parent: Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>
0 siblings, 0 replies; 5+ messages in thread
From: Scott Ribe @ 2016-04-22 11:13 UTC (permalink / raw)
To: Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>; +Cc: pgsql-general
On Apr 21, 2016, at 8:25 PM, Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com> wrote:
>
> Looks like one has the appropiate cast operator, while the other hasn't. Have you tried doing the same, on both server, on an empty database created from template0?
Excellent suggestion:
pedcard=# create database test;
CREATE DATABASE
pedcard=# \c test
SSL connection (protocol: TLSv1, cipher: DHE-RSA-AES256-SHA, bits: 256, compression: off)
You are now connected to database "test" as user "admin".
test=# 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[].
--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: different empty array syntax requirements
@ 2016-04-22 11:21 Scott Ribe <scott_ribe@elevated-dev.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: Scott Ribe @ 2016-04-22 11:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general
On Apr 21, 2016, at 8:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> 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.
I figured that. The mystery is why on my pg, and not on the other. I've asked the other guy to try it in a newly-created database.
> That's a bug. Will fix it.
OK, cool.
--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2016-04-22 11:21 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 02:20 different empty array syntax requirements Scott Ribe <scott_ribe@elevated-dev.com>
2016-04-22 02:25 ` Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>
2016-04-22 11:13 ` Scott Ribe <scott_ribe@elevated-dev.com>
2016-04-22 02:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-04-22 11:21 ` Scott Ribe <scott_ribe@elevated-dev.com>
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