ALTER EXTENSION SET SCHEMA versus dependent types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: ALTER EXTENSION SET SCHEMA versus dependent types
Date: 2024-05-08 21:52:31
Message-ID: 930191.1715205151@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I happened to notice that the comment for AlterObjectNamespace_oid
claims that

* ... it doesn't have to deal with certain special cases
* such as not wanting to process array types --- those should never
* be direct members of an extension anyway.

This struck me as probably broken in the wake of e5bc9454e
(Explicitly list dependent types as extension members in pg_depend),
and sure enough a moment's worth of testing showed it is:

regression=# create schema s1;
CREATE SCHEMA
regression=# create extension cube with schema s1;
CREATE EXTENSION
regression=# create schema s2;
CREATE SCHEMA
regression=# alter extension cube set schema s2;
ERROR: cannot alter array type s1.cube[]
HINT: You can alter type s1.cube, which will alter the array type as well.

So we need to do something about that; and the fact that this escaped
testing shows that our coverage for ALTER EXTENSION SET SCHEMA is
pretty lame.

The attached patch fixes up the code and adds a new test to
the test_extensions module. The fix basically is to skip the
pg_depend entries for dependent types, assuming that they'll
get dealt with when we process their parent objects.

regards, tom lane

Attachment Content-Type Size
v1-fix-set-schema-for-dependent-types.patch text/x-diff 13.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-05-08 22:02:06 Re: Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail.
Previous Message Alexander Korotkov 2024-05-08 21:51:32 Re: Add SPLIT PARTITION/MERGE PARTITIONS commands