Fix failure of ALTER FOREIGN TABLE SET SCHEMA to move sequences.
commita8b7408686a5576cf3b102dcbec61d37dde04b02
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Mar 2024 19:28:16 +0000 (26 15:28 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Mar 2024 19:28:16 +0000 (26 15:28 -0400)
tree06f63847570299388a80daafd6b21b6b3dd24467
parent7124e7d528a89b6fa4cbe803cf85ecf6ddff29c3
Fix failure of ALTER FOREIGN TABLE SET SCHEMA to move sequences.

Ordinary ALTER TABLE SET SCHEMA will also move any owned sequences
into the new schema.  We failed to do likewise for foreign tables,
because AlterTableNamespaceInternal believed that only certain
relkinds could have indexes, owned sequences, or constraints.
We could simply add foreign tables to that relkind list, but it
seems likely that the same oversight could be made again in
future.  Instead let's remove the relkind filter altogether.
These functions shouldn't cost much when there are no objects
that they need to process, and surely this isn't an especially
performance-critical case anyway.

Per bug #18407 from Vidushi Gupta.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18407-4fd07373d252c6a0@postgresql.org
src/backend/commands/tablecmds.c
src/test/regress/expected/foreign_data.out
src/test/regress/sql/foreign_data.sql