Re: altering a column to to make it generated

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Celia McInnis <celia(dot)mcinnis(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: altering a column to to make it generated
Date: 2024-04-22 20:11:43
Message-ID: 3155442.1713816703@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Mon, Apr 22, 2024 at 12:42 PM Celia McInnis <celia(dot)mcinnis(at)gmail(dot)com>
> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Atul Kumar 2024-04-22 20:13:58 issue with reading hostname
Previous Message Adrian Klaver 2024-04-22 20:01:04 Re: altering a column to to make it generated