Repair ALTER EXTENSION ... SET SCHEMA.
commit9effc4608e1f6d19546a0e0f64320f4b0dd10c3c
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 9 May 2024 16:19:43 +0000 (9 12:19 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 9 May 2024 16:19:52 +0000 (9 12:19 -0400)
treeb0c4d38060d95ee3b4a7cd12368b531520e9d433
parentd82ab9fc31aa62d94c26d7df98e65c6ceaadb01f
Repair ALTER EXTENSION ... SET SCHEMA.

It turns out that we broke this in commit e5bc9454e, because
the code was assuming that no dependent types would appear
among the extension's direct dependencies, and now they do.

This isn't terribly hard to fix: just skip dependent types,
expecting that we will recurse to them when we process the parent
object (which should also be among the direct dependencies).
But a little bit of refactoring is needed so that we can avoid
duplicating logic about what is a dependent type.

Although there is some testing of ALTER EXTENSION SET SCHEMA,
it failed to cover interesting cases, so add more tests.

Discussion: https://postgr.es/m/930191.1715205151@sss.pgh.pa.us
src/backend/commands/alter.c
src/backend/commands/extension.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/include/commands/typecmds.h
src/test/modules/test_extensions/Makefile
src/test/modules/test_extensions/expected/test_extensions.out
src/test/modules/test_extensions/meson.build
src/test/modules/test_extensions/sql/test_extensions.sql
src/test/modules/test_extensions/test_ext_set_schema--1.0.sql [new file with mode: 0644]
src/test/modules/test_extensions/test_ext_set_schema.control [new file with mode: 0644]