Hi Ian,

Thanks for working on this

Ian Lawrence Barwick <[email protected]>, 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

Reply via email to