Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
amul sul <sulamul@gmail.com>
From: Amul Sul <sulamul@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Robert Haas <robertmhaas@gmail.com>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2023-11-14T10:40:04Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
ALTER TABLE command to change generation expression
- 5d06e99a3cfc 17.0 landed
-
Refactor: separate function to find all objects depending on a column
- d4e66a39eb96 17.0 landed
-
Turn AT_PASS_* macros into an enum
- cea89c93a102 17.0 landed
Attachments
- v4-0001-Allow-to-change-generated-column-expression.patch (application/octet-stream) patch v4-0001
On Mon, Nov 13, 2023 at 9:09 PM Peter Eisentraut <peter@eisentraut.org> wrote: > On 13.11.23 14:07, Amul Sul wrote: > > Also, it seems to me that the SET EXPRESSION variant should just do > an > > update of the catalog table instead of a drop and re-insert. > > > > I am not sure if that is sufficient; we need to get rid of the > > dependencies of > > existing expressions on other columns and/or objects that need to be > > removed. > > The drop and re-insert does that easily. > > Ok, good point. > > > The documentation needs some improvements: > > > > + ALTER [ COLUMN ] <replaceable > > class="parameter">column_name</replaceable> SET EXPRESSION > <replaceable > > class="parameter">expression</replaceable> STORED > > > > If we're going to follow the Db2 syntax, there should be an "AS" > after > > EXPRESSION. And the implemented syntax requires parentheses, so they > > should appear in the documentation. > > > > Also, the keyword STORED shouldn't be there. (The same command > should > > be applicable to virtual generated columns in the future.) > > > > I have omitted "AS" intentionally, to keep syntax similar to our existing > > ALTERCOLUMN... SET DEFAULT <a_expr>. Let me know if you want > > me to add that. > > Well, my idea was to follow the Db2 syntax. Otherwise, we are adding > yet another slightly different syntax to the world. Even if we think > our idea is slightly better, it doesn't seem worth it. > Ok. Please have a look at the attached version, updating the syntax to have "AS" after EXPRESSION and other changes suggested previously. Regards, Amul