postgresql/src/test/modules/test_extensions
Tom Lane b3427dade1 Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits.
deleteWhatDependsOn() had grown an uncomfortably large number of
assumptions about what it's used for.  There are actually only two minor
differences between what it does and what a regular performDeletion() call
can do, so let's invent additional bits in performDeletion's existing flags
argument that specify those behaviors, and get rid of deleteWhatDependsOn()
as such.  (We'd probably have done it this way from the start, except that
performDeletion didn't originally have a flags argument, IIRC.)

Also, add a SKIP_EXTENSIONS flag bit that prevents ever recursing to an
extension, and use that when dropping temporary objects at session end.
This provides a more general solution to the problem addressed in a hacky
way in commit 08dd23cec: if an extension script creates temp objects and
forgets to remove them again, the whole extension went away when its
contained temp objects were deleted.  The previous solution only covered
temp relations, but this solves it for all object types.

These changes require minor additions in dependency.c to pass the flags
to subroutines that previously didn't get them, but it's still a net
savings of code, and it seems cleaner than before.

Having done this, revert the special-case code added in 08dd23cec that
prevented addition of pg_depend records for temp table extension
membership, because that caused its own oddities: dropping an extension
that had created such a table didn't automatically remove the table,
leading to a failure if the table had another dependency on the extension
(such as use of an extension data type), or to a duplicate-name failure if
you then tried to recreate the extension.  But we keep the part that
prevents the pg_temp_nnn schema from becoming an extension member; we never
want that to happen.  Add a regression test case covering these behaviors.

Although this fixes some arguable bugs, we've heard few field complaints,
and any such problems are easily worked around by explicitly dropping temp
objects at the end of extension scripts (which seems like good practice
anyway).  So I won't risk a back-patch.

Discussion: https://postgr.es/m/e51f4311-f483-4dd0-1ccc-abec3c405110@BlueTreble.com
2016-12-02 14:57:55 -05:00
..
expected Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
sql Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
.gitignore Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
Makefile Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
test_ext1--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext1.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext2--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext2.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext3--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext3.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext4--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext4.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext5--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext5.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
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_ext_cyclic1--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext_cyclic1.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext_cyclic2--1.0.sql Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00
test_ext_cyclic2.control Add CASCADE support for CREATE EXTENSION. 2015-10-03 18:23:40 +02:00