[GENERAL] Surprising results from array concatenation
| От | Mike Blackwell |
|---|---|
| Тема | [GENERAL] Surprising results from array concatenation |
| Дата | |
| Msg-id | CANPAkguH_mhK2WG-aOne9g2iYegTQ7mk8nBT3NkzyppTV265MA@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: [GENERAL] Surprising results from array concatenation
|
| Список | 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.Blackwell@rrd.com
http://www.rrdonnelley.com
В списке pgsql-general по дате отправления: