Re: support ALTER TABLE DROP EXPRESSION for virtual generated column - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: support ALTER TABLE DROP EXPRESSION for virtual generated column
Date
Msg-id CAKFQuwZt41PbKGwc4rFeZsrUZ0jiunrZ7macvQyhm6QLNwBrPQ@mail.gmail.com
Whole thread Raw
In response to Re: support ALTER TABLE DROP EXPRESSION for virtual generated column  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: support ALTER TABLE DROP EXPRESSION for virtual generated column
List pgsql-hackers
On Wednesday, March 26, 2025, Tom Lane <tgl@sss.pgh.pa.us> wrote:
jian he <jian.universality@gmail.com> writes:
> the attached patch is to implement $subject.

Why would this be a good idea?  I don't see any principled fallback
definition of the column.  (No, "NULL" is not that.)  Certainly we
should support ALTER TABLE DROP COLUMN, but removing the expression
and not providing a substitute seems semantically nonsensical.

I don’t follow how NULL got involved in this discussion. The proposal is basically: turn the virtual expression into an equivalent stored expression, then drop the expression.

I suppose it would make sense to first add an alter table command to allow the user to do a virtual/stored mode swap manually before adding this, which then just becomes a convenient way to specify swap-and-drop as a single command.

David J.

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: [PATCH] SVE popcount support
Next
From: "cca5507"
Date:
Subject: Re: Historic snapshot doesn't track txns committed in BUILDING_SNAPSHOT state