diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-12-02 14:57:35 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-12-02 14:57:55 -0500 |
| commit | b3427dade14cc31eb48740bc9ea98b5954470b24 (patch) | |
| tree | e0633c5d3a1bbbf07528c9457f621d3f325bd49c /doc/src | |
| parent | 13df76a537cca3b8884911d8fdf7c89a457a8dd3 (diff) | |
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
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/extend.sgml | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index f9d91a39235..c4f211bc024 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -390,6 +390,15 @@ schema(s) its member objects are within. </para> + <para> + If an extension's script creates any temporary objects (such as temp + tables), those objects are treated as extension members for the + remainder of the current session, but are automatically dropped at + session end, as any temporary object would be. This is an exception + to the rule that extension member objects cannot be dropped without + dropping the whole extension. + </para> + <sect2> <title>Extension Files</title> @@ -803,7 +812,8 @@ SELECT pg_catalog.pg_extension_config_dump('my_config', 'WHERE NOT standard_entr environment that <command>CREATE EXTENSION</> provides for installation scripts: in particular, <varname>search_path</> is set up in the same way, and any new objects created by the script are automatically added - to the extension. + to the extension. Also, if the script chooses to drop extension member + objects, they are automatically dissociated from the extension. </para> <para> |
