Re: Accommodating alternative column values

From: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Accommodating alternative column values
Date: 2024-07-03 14:04:21
Message-ID: CAKkG4_n_pT-CB2_yyCVpwM5vXnRoKzZobZbrQop90uvqaq1tXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You could try

ALTER TABLE ... SET TYPE TEXT[] USING ARRAY[email]::TEXT[]

something along these lines.

On Wed, Jul 3, 2024 at 3:58 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> On Tue, 2 Jul 2024, Christophe Pettus wrote:
>
> > To be clear, I wasn't suggesting stuffing them all into a text column
> with
> > a delimiter, but storing them in a text *array* field, each email address
> > one component of the array.
>
> Christophe,
>
> I'm not using the proper syntax and the postgres alter table doc has no
> example in the alter column choices.
>
> What I've tried:
> bustrac=# alter table people alter column email set data type varchar(64)
> [];
> ERROR: column "email" cannot be cast automatically to type character
> varying[]
> HINT: You might need to specify "USING email::character varying(64)[]".
>
> How do I incorporate the "USING email::..." string?
>
> TIA,
>
> Rich
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2024-07-03 14:05:36 Re: Accommodating alternative column values
Previous Message Rich Shepard 2024-07-03 14:03:42 Re: Accommodating alternative column values