postgresql/src/include/commands
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
..
alter.h Support ALTER THING .. DEPENDS ON EXTENSION 2016-04-05 18:38:54 -03:00
async.h Final pgindent + perltidy run for 9.6. 2016-08-15 13:42:51 -04:00
cluster.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
collationcmds.h Add location field to DefElem 2016-09-06 12:00:00 -04:00
comment.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
conversioncmds.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
copy.h Add location field to DefElem 2016-09-06 12:00:00 -04:00
createas.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
dbcommands.h Add location field to DefElem 2016-09-06 12:00:00 -04:00
dbcommands_xlog.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
defrem.h Add location field to DefElem 2016-09-06 12:00:00 -04:00
discard.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
event_trigger.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
explain.h Add location field to DefElem 2016-09-06 12:00:00 -04:00
extension.h Delete deleteWhatDependsOn() in favor of more performDeletion() flag bits. 2016-12-02 14:57:55 -05:00
lockcmds.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
matview.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
policy.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
portalcmds.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
prepare.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
proclang.h Change many routines to return ObjectAddress rather than OID 2015-03-03 14:10:50 -03:00
progress.h Add simple VACUUM progress reporting. 2016-03-15 13:32:56 -04:00
schemacmds.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
seclabel.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
sequence.h Add pg_sequences view 2016-11-18 14:59:03 -05:00
tablecmds.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
tablespace.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
trigger.h Implement syntax for transition tables in AFTER triggers. 2016-11-04 10:49:50 -05:00
typecmds.h Add location field to DefElem 2016-09-06 12:00:00 -04:00
user.h Turn password_encryption GUC into an enum. 2016-09-28 12:22:44 +03:00
vacuum.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
variable.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
view.h Update copyright for 2016 2016-01-02 13:33:40 -05:00