| From: | Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com> |
|---|---|
| To: | Ian Lawrence Barwick <barwick(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Support "ALTER FOREIGN TABLE ... RENAME CONSTRAINT ..." |
| Date: | 2026-11-20 15:22:10 |
| Message-ID: | CAGPVpCTGo9zNAzJH0hJN=yh__T3SzLWH9WUJ-_hMkD_Wd-gKYQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Ian,
Thanks for working on this
Ian Lawrence Barwick <barwick(at)gmail(dot)com>, 30 Eki 2026 Cum, 10:21 tarihinde
şunu yazdı:
> I can't see any reason not to do this, the code change is fairly small, and
> ALTER FOREIGN TABLE has other non-standard extensions anyway.
>
I agree.
> I should note that "ALTER TABLE ... RENAME CONSTRAINT" does work on all
> table-like objects [*]; this wasn't obvious to me when I first ran into the
> issue, and it seems inconsistent that "OWNER TO" works with both "ALTER
> TABLE"
> and "ALTER FOREIGN TABLE".
>
> [*]
> https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DESC-RENAME
I didn’t realize this before, so I looked into it a bit more. It seems that
ALTER FOREIGN TABLE on a plain table is rejected except for RENAME COLUMN.
The others simply fail with a “... is not a foreign table” error. On the
other hand, ALTER TABLE on a foreign table is always accepted as long as
the operation makes sense for foreign tables.
The patch also allows running ALTER FOREIGN TABLE ... RENAME CONSTRAINT on
a plain table. I’m not sure whether we should keep allowing it, given that
RENAME COLUMN works for plain tables too while the others are simply
rejected.
There are also more strange things with RENAME; for example, commands like
ALTER FOREIGN TABLE <materialized view> RENAME COLUMN or ALTER INDEX
<foreign table> RENAME also work.
--
Best regards,
Melih
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Raja Sai pranav | 2026-11-20 15:22:11 | pg_waldump: WAL in pg_wal.old/ inside a tar archive is read as WAL |
| Previous Message | Tom Lane | 2026-11-20 15:18:36 | Re: timetz does not recognize localized timezone names (tested on v14 to v18) |