From: | Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Surprising results from array concatenation |
Date: | 2017-04-25 16:26:53 |
Message-ID: | CANPAkguH_mhK2WG-aOne9g2iYegTQ7mk8nBT3NkzyppTV265MA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
The docs (section 9.18 for PG 9.6) show as an example for array
concatenation
ARRAY[4,5,6] || 7
which works fine. However, trying the same with an array of text doesn't
work:
# select array['a','b','c'] || 'd';
ERROR: malformed array literal: "d"
LINE 1: select array['a','b','c'] || 'd';
^
DETAIL: Array value must start with "{" or dimension information.
Casting the second value to TEXT works.
# select array['a','b','c'] || 'd'::TEXT;
?column?
-----------
{a,b,c,d}
(1 row)
The assumption that the second argument is an array constant seems
surprising.
__________________________________________________________________________________
*Mike Blackwell | Technical Analyst, Distribution Services/Rollout
Management | RRD*
1750 Wallace Ave | St Charles, IL 60174-3401
Office: 630.313.7818
Mike(dot)Blackwell(at)rrd(dot)com
http://www.rrdonnelley.com
<http://www.rrdonnelley.com/>
* <Mike(dot)Blackwell(at)rrd(dot)com>*
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-04-25 16:41:30 | Re: Surprising results from array concatenation |
Previous Message | Claudio Freire | 2017-04-25 16:07:41 | Re: Questionaire: Common WAL write rates on busy servers. |