postgresql/src/test/modules/test_extensions
Tom Lane e5bc9454e5 Explicitly list dependent types as extension members in pg_depend.
Auto-generated array types, multirange types, and relation rowtypes
are treated as dependent objects: they can't be dropped separately
from the base object, nor can they have their own ownership or
permissions.  We previously felt that, for objects that are in an
extension, only the base object needs to be listed as an extension
member in pg_depend.  While that's sufficient to prevent inappropriate
drops, it results in undesirable answers if someone asks whether a
dependent type belongs to the extension.  It looks like the dependent
type is just some random separately-created object that happens to
depend on the base object.  Notably, this results in postgres_fdw
concluding that expressions involving an array type are not shippable
to the remote server, even when the defining extension has been
whitelisted.

To fix, cause GenerateTypeDependencies to make extension dependencies
for dependent types as well as their base objects, and adjust
ExecAlterExtensionContentsStmt so that object addition and removal
operations recurse to dependent types.  The latter change means that
pg_upgrade of a type-defining extension will end with the dependent
type(s) now also listed as extension members, even if they were
not that way in the source database.  Normally we want pg_upgrade
to precisely reproduce the source extension's state, but it seems
desirable to make an exception here.

This is arguably a bug fix, but we can't back-patch it since it
causes changes in the expected contents of pg_depend.  (Because
it does, I've bumped catversion, even though there's no change
in the immediate post-initdb catalog contents.)

Tom Lane and David Geier

Discussion: https://postgr.es/m/4a847c55-489f-4e8d-a664-fc6b1cbe306f@gmail.com
2024-03-04 14:49:36 -05:00
..
expected Explicitly list dependent types as extension members in pg_depend. 2024-03-04 14:49:36 -05:00
sql Explicitly list dependent types as extension members in pg_depend. 2024-03-04 14:49:36 -05:00
.gitignore
Makefile Explicitly list dependent types as extension members in pg_depend. 2024-03-04 14:49:36 -05:00
meson.build Explicitly list dependent types as extension members in pg_depend. 2024-03-04 14:49:36 -05:00
test_ext1--1.0.sql
test_ext1.control
test_ext2--1.0.sql
test_ext2.control
test_ext3--1.0.sql Ensure commands in extension scripts see the results of preceding DDL. 2017-05-02 18:06:09 -04:00
test_ext3.control
test_ext4--1.0.sql
test_ext4.control
test_ext5--1.0.sql
test_ext5.control
test_ext6--1.0.sql In recordExtensionInitPriv(), keep the scan til we're done with it 2016-04-15 21:57:15 -04:00
test_ext6.control In recordExtensionInitPriv(), keep the scan til we're done with it 2016-04-15 21:57:15 -04:00
test_ext7--1.0--2.0.sql Fix test about ignoring extension dependencies during extension scripts. 2016-11-26 13:31:35 -05:00
test_ext7--1.0.sql Fix test about ignoring extension dependencies during extension scripts. 2016-11-26 13:31:35 -05:00
test_ext7.control Fix test about ignoring extension dependencies during extension scripts. 2016-11-26 13:31:35 -05:00
test_ext8--1.0.sql Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
test_ext8.control Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
test_ext9--1.0.sql Explicitly list dependent types as extension members in pg_depend. 2024-03-04 14:49:36 -05:00
test_ext9.control Explicitly list dependent types as extension members in pg_depend. 2024-03-04 14:49:36 -05:00
test_ext_cine--1.0--1.1.sql In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
test_ext_cine--1.0.sql In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
test_ext_cine.control In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
test_ext_cor--1.0.sql In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
test_ext_cor.control In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
test_ext_cyclic1--1.0.sql
test_ext_cyclic1.control
test_ext_cyclic2--1.0.sql
test_ext_cyclic2.control
test_ext_evttrig--1.0--2.0.sql Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
test_ext_evttrig--1.0.sql Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
test_ext_evttrig.control Fix use-after-free bug with event triggers in an extension script 2020-09-15 21:03:14 -03:00
test_ext_extschema--1.0.sql Reject substituting extension schemas or owners matching ["$'\]. 2023-08-07 06:05:56 -07:00
test_ext_extschema.control Reject substituting extension schemas or owners matching ["$'\]. 2023-08-07 06:05:56 -07:00
test_ext_req_schema1--1.0.sql Add @extschema:name@ and no_relocate options to extensions. 2023-03-20 18:37:11 -04:00
test_ext_req_schema1.control Add @extschema:name@ and no_relocate options to extensions. 2023-03-20 18:37:11 -04:00
test_ext_req_schema2--1.0.sql Add @extschema:name@ and no_relocate options to extensions. 2023-03-20 18:37:11 -04:00
test_ext_req_schema2.control Add @extschema:name@ and no_relocate options to extensions. 2023-03-20 18:37:11 -04:00
test_ext_req_schema3--1.0.sql Add @extschema:name@ and no_relocate options to extensions. 2023-03-20 18:37:11 -04:00
test_ext_req_schema3.control Add @extschema:name@ and no_relocate options to extensions. 2023-03-20 18:37:11 -04:00