From: | Michael Herold <quabla(at)hemio(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-docs(at)postgresql(dot)org |
Subject: | Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL) |
Date: | 2015-10-26 10:04:40 |
Message-ID: | 562DFAB8.9050507@hemio.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
I just got confused by another behavior of the || operator. I thought it
might be appropriate to report it here.
The docs say "the result retains the lower bound subscript of the
left-hand operand’s outer dimension" [1]. That's again not true for
corner cases.
Expected:
# SELECT '{0}'::int[] || '[15:16]={1,2}';
----------
{0,1,2}
Unexpected (lower bound is untouched):
# SELECT '{}'::int[] || '[15:16]={1,2}';
---------------
[15:16]={1,2}
Actually, I was looking for a way to reset the index lower bound of an
array to the default. I didn't found a solution documented anywhere, [2]
only works for known array sizes. So, it might also be worth stating
ARRAY(SELECT UNNEST(...)) as a solution?
[1]: <http://www.postgresql.org/docs/9.5/static/arrays.html>
[2]: <http://www.postgresql.org/message-id/40854D0B.6000005@cromwell.co.uk>
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Lakhin | 2015-10-26 10:53:15 | Re: Moving documentation to XML |
Previous Message | Rob Sargent | 2015-10-23 17:18:39 | Re: ubuntu deb packaging |