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 1sP0cA-002RQG-HJ for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 14:05:42 +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 1sP0c8-009Ntw-HZ for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 14:05:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP0c8-009Nto-6b for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 14:05:40 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sP0c6-000D9S-Fk for pgsql-general@postgresql.org; Wed, 03 Jul 2024 14:05:39 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-25e00f348e6so784298fac.1 for ; Wed, 03 Jul 2024 07:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720015537; x=1720620337; darn=postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rOovPWc1Nbm/R+PS7KYdcFWZLmMNQ+9QLpLooKu5+i8=; b=C3sU/3b2PxM1eZIIEY0OyzjB8sL9ZlkLSNZjkJxX59wbaCM+MvHZicKV6yRJa0Kbp0 H70E9Mf6kpBtfsEx7a5dkHm8D+WWo5ePA0oE1kthqxrrqFRWOvLKLe5E6CJbkAttRQU8 ON6/671mmINcXOCVp6RfQ0vSdhaJo/+XTrJMlHusHenXo3+crAl/Q5ZAx7N6TMae7p7D IIUtS7dxshbwZLI2d9KA7ceuYmfVPVGy/Q/zsylVAvTrgm5dQCHCALrZN0KsuYbPLX0V oDXfmDqeU8PJanCQbx8GYtxRK2wo10Nucib5RC10i3slxXsnMsBeEquVaYCO546Ii+vj wYGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720015537; x=1720620337; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rOovPWc1Nbm/R+PS7KYdcFWZLmMNQ+9QLpLooKu5+i8=; b=Hv5VQDMxt87TfjjIZf20xyxDL7qMN2h1Fxm13vqO7XeneLZi2p2CEeygsJ7wHgQWcB ZfnRujGVE+A4FATQlKwdTWSRO9reBM3dFB3pE8ecIP+qTmPgWwr2ii5jqz//7R6aX/1L /rw2hHK9UYZAnD8mUDDhU2j4nllphXjcE5bwV7Sc5oPG5uQNisGpsj/bj56RNQj7gHDX ux6EGMmzhxIV426JvDh9qdb9fpffue4bKAu+RJSQEmCSj4ehoXgXL1uPeUB8CgI2qpDz EH1ezbjbN0xfzxbfWHiANj7viGgPnaNicBaSCNhkPHzHpLxyJwkS72X5OIPQ0CW4zlvf vqUQ== X-Gm-Message-State: AOJu0YyrbXVj+MxmimUHBO6v/+IvbzmTFmtz5LZjNjHEU2XFWz6jwSKj 9oCHUcmLMGXvGmImCBJuuXXic0a5gMc7mjWSitNkI0CUuw4Czy/3mP6Bn5Cg6bgSOZFTnB0Us5J 5IQBuSAqMkGYg/yiwDha3UAMw7Ho= X-Google-Smtp-Source: AGHT+IEOfXVOG4vZ7EqOlUvND6vIgNBCvvhLtkxnp/Ai/QhAffAilhB/YhPjDOHVdN2O8Ci3VtXkbFr7HT6sRM4d880= X-Received: by 2002:a05:6870:970c:b0:254:832e:c0ed with SMTP id 586e51a60fabf-25db3615d4dmr11157918fac.51.1720015537407; Wed, 03 Jul 2024 07:05:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:6850:0:b0:539:aa10:6c7 with HTTP; Wed, 3 Jul 2024 07:05:36 -0700 (PDT) In-Reply-To: <3eb9a2d3-28c-9066-d3b5-fd6cca32af9@appl-ecosys.com> References: <449bdf5-31d-9189-34d-5ce4188fe2@appl-ecosys.com> <74f52ac6-61cb-f995-34e5-16271b5c6832@appl-ecosys.com> <3eb9a2d3-28c-9066-d3b5-fd6cca32af9@appl-ecosys.com> From: "David G. Johnston" Date: Wed, 3 Jul 2024 07:05:36 -0700 Message-ID: Subject: Re: Accommodating alternative column values To: Rich Shepard Cc: "pgsql-general@postgresql.org" Content-Type: multipart/alternative; boundary="0000000000001d8dd9061c5853c2" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001d8dd9061c5853c2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wednesday, July 3, 2024, Rich Shepard wrote: > On Wed, 3 Jul 2024, Rich Shepard wrote: > > What I've tried: >> bustrac=3D# 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)[]". >> > > What I forgot to mention is that the current datatype is varchar(64) and = I > want to make it an array. > > Yeah, the simply cast suggested will not work. You=E2=80=99d 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 J. --0000000000001d8dd9061c5853c2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Wednesday, July 3, 2024, Rich Shepard <rshepard@appl-ecosys.com> wrote:
On Wed, 3 Jul 2024, Rich Shepard wrote:

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)[]".

What I forgot to mention is that the current datatype is varchar(64) and I<= br> want to make it an array.


Yeah, the simply cast suggested will not w= ork.=C2=A0 You=E2=80=99d have to apply an expression that turns the current= contents into an array.=C2=A0 The current contents are not likely to be an= array literal.

David J.
--0000000000001d8dd9061c5853c2--