Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP0b8-002RMk-SI for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 14:04:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sP0b6-009KpZ-QE for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 14:04:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP0b6-009Kmr-Ea for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 14:04:37 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sP0b5-000EHN-2n for pgsql-general@postgresql.org; Wed, 03 Jul 2024 14:04:36 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52ce6c8db7bso8408814e87.1 for ; Wed, 03 Jul 2024 07:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720015474; x=1720620274; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hTX/+L7u35V+9/nfWmN3gZTY4rDHkGommlIra/I+L+U=; b=mSlv7fdzoQaOSiDQFl05ATMqC/8gZvUZI6cNx0HhcAp86EBsTzTYno4Bd5QKwqpslF N7C6fv4J+T+G5cFrzJNDXI4V2OMUh50wULkW/MoXa3NNPJ0aasY6rQz9Zgxr/UI0hLIk 9dfjmAZATp/jKhlowhBtfG+VH8w51/gIpm2bBiTMmFXtk/RqnQgPp9cZp3pgl+h6CHto CEFYlpMj16Y4HKvhBgFaMFo0BLkOLSO1f+c/C74VHMfdz2RkFfD0SrIpAYfGSo1CHu0z Vz+08Wv4UG5OEZV4Wf+su2X/Z/k3Mkqd/Vl/XhGBwoCPC3e2zYMqgtT9DQl7R67hvDFz E7bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720015474; x=1720620274; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hTX/+L7u35V+9/nfWmN3gZTY4rDHkGommlIra/I+L+U=; b=XT8sszebsFB5GIOWxBsmzxWx7AEjqFsp9AAHQwrwbwxxfYUlmYH1nPPoHlFsy/5zyK Ydt/7CYJgkjw/8mXA2udJwpQQKPKPyAwHOAa4ILTMb59ZNVX6QUD0VUXJtcD3VlBPuJV O6w3eH5A8chzAGrCaoTLL9qP9Vhe2bepx5pu86j6OHyV0wUc7AlnFuWSejiKzoTm+Vq0 mBCghj+FQ/1rvzioLBVgz1I2AUAgpm8wmtv4e/cfWbTGADRFHu+AJMH3ZgyhBgPKap8T PkStAYpXm4lg6K3ZZpYQWTP+nHIdRP3T/GopMBu785U1tYXJYPARDDqOlwktvluKePDf 7UYA== X-Gm-Message-State: AOJu0Yzr/KYYIxyI9POC0SUuo4k/Ugk7339O6ISq6DhZduOy3aa26i9b nWVyOvsIoy2SkDImh3yqVAgHHQzMNzVIdA3wD0EdrHcBaRutzatMqY7ShX80+sBAUTv7rNIc85M HUihgWbCkhsR65+UjMrkfz4US3C07bVQ= X-Google-Smtp-Source: AGHT+IHhhXHQDOQwQxTe6Byh7R11my6LgkmeO31qpLDp+bYXaNzwE9bZgql/eceQgRuYATG2JIS5SFEEikOE0NChWP4= X-Received: by 2002:a05:6512:33d5:b0:52c:d13e:3785 with SMTP id 2adb3069b0e04-52e82691ab3mr7910978e87.30.1720015473685; Wed, 03 Jul 2024 07:04:33 -0700 (PDT) MIME-Version: 1.0 References: <449bdf5-31d-9189-34d-5ce4188fe2@appl-ecosys.com> <74f52ac6-61cb-f995-34e5-16271b5c6832@appl-ecosys.com> In-Reply-To: <74f52ac6-61cb-f995-34e5-16271b5c6832@appl-ecosys.com> From: =?UTF-8?Q?Torsten_F=C3=B6rtsch?= Date: Wed, 3 Jul 2024 16:04:21 +0200 Message-ID: Subject: Re: Accommodating alternative column values To: Rich Shepard Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="000000000000513f4f061c584f6a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000513f4f061c584f6a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You could try ALTER TABLE ... SET TYPE TEXT[] USING ARRAY[email]::TEXT[] something along these lines. On Wed, Jul 3, 2024 at 3:58=E2=80=AFPM Rich Shepard 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 addre= ss > > 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=3D# alter table people alter column email set data type varchar(6= 4) > []; > 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 > > > --000000000000513f4f061c584f6a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You could try

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

something along = these lines.

On Wed, Jul 3, 2024 at 3:58=E2=80=AFPM Rich Shepard <<= a href=3D"mailto:rshepard@appl-ecosys.com">rshepard@appl-ecosys.com>= wrote:
On Tue, = 2 Jul 2024, Christophe Pettus wrote:

> To be clear, I wasn't suggesting stuffing them all into a text col= umn with
> a delimiter, but storing them in a text *array* field, each email addr= ess
> 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=3D# alter table people alter column email set data type varchar(64)= [];
ERROR:=C2=A0 column "email" cannot be cast automatically to type = character varying[]
HINT:=C2=A0 You might need to specify "USING email::character varying(= 64)[]".

How do I incorporate the "USING email::..." string?

TIA,

Rich


--000000000000513f4f061c584f6a--