From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Support multi-column renaming? |
Date: | 2024-08-06 13:58:11 |
Message-ID: | CALdSSPibxMb45wnSxtbc46Lveau5TDkW32W_mrW=-jQDOrTvDQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I have noticed that ALTER TABLE supports multiple column actions
(ADD/DROP column etc), but does not support multiple column renaming.
See [1]
Here is small example of what im talking about:
```
db2=# create table tt();
CREATE TABLE
-- multiple column altering ok
db2=# alter table tt add column i int, add column j int;
ALTER TABLE
-- single column renaming ok
db2=# alter table tt rename column i to i2;
ALTER TABLE
-- multiple column renaming not allowed
db2=# alter table tt rename column i2 to i3, rename column j to j2;
ERROR: syntax error at or near ","
LINE 1: alter table tt rename column i2 to i3, rename column j to j2...
^
db2=#
```
Looking closely on gram.y, the only reason for this is that RenameStmt
is defined less flexible than alter_table_cmds (which is a list). All
other core infrastructure is ready to allow $subj.
So is it worth a patch?
[1] https://www.postgresql.org/docs/current/sql-altertable.html
--
Best regards,
Kirill Reshke
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2024-08-06 14:00:34 | Re: Rename C23 keyword |
Previous Message | Marcos Pegoraro | 2024-08-06 13:57:00 | Re: Detailed release notes |