Re: Accommodating alternative column values
От | Torsten Förtsch |
---|---|
Тема | Re: Accommodating alternative column values |
Дата | |
Msg-id | CAKkG4_nzcBWejwRdwenPvNE4RuMMJFzKOWSCpTywCYRs+W2pOg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Accommodating alternative column values (Rich Shepard <rshepard@appl-ecosys.com>) |
Список | pgsql-general |
Check this out
https://www.postgresql.org/docs/16/arrays.html#ARRAYS-INPUTYou can use
('{' || email || '}')::varchar(64)[]
or the syntax I suggested earlier.
On Wed, Jul 3, 2024 at 4:13 PM Rich Shepard <rshepard@appl-ecosys.com> wrote:
On Wed, 3 Jul 2024, David G. Johnston wrote:
> Yeah, the simply cast suggested will not work. You’d have to apply an
> expression that turns the current contents into an array. The current
> contents are not likely to be an array literal.
David,
No, it's not now an array.
I thought that this expression would work, but it doesn't:
bustrac=# alter table people alter column email set data type varchar(64)[] using email::varchar(64)[];
RROR: malformed array literal: "frank@dmipx.com"
DETAIL: Array value must start with "{" or dimension information.
If I correctly understand the error detail I'd need to change the contents
of that column for all 1280 rows to enclose the contents in curly braces
before I can convert the datatype to an array. Is that correct?
Rich
В списке pgsql-general по дате отправления: