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 1rz00z-001Ssk-Lp for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 20:11:49 +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 1rz00x-00FCu0-W5 for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 20:11:47 +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 1rz00x-00FCtr-LH for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 20:11:47 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rz00u-0048ht-TS for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 20:11:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 43MKBhSv3155443; Mon, 22 Apr 2024 16:11:43 -0400 From: Tom Lane To: "David G. Johnston" cc: Celia McInnis , "pgsql-generallists.postgresql.org" Subject: Re: altering a column to to make it generated In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Mon, 22 Apr 2024 12:45:46 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3155441.1713816703.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 22 Apr 2024 16:11:43 -0400 Message-ID: <3155442.1713816703@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Mon, Apr 22, 2024 at 12:42 PM Celia McInnis > wrote: >> Can I alter a table column to now make it generated? I tried this >> unsuccessfully: > I looked at all of the "alter table ... alter column" commands listed here: > https://www.postgresql.org/docs/current/sql-altertable.html > And none seem to involve the generated expression column. So the answer is > no. I think what you'd need to do is drop the existing column and then add a generated column. regards, tom lane