Re: dealing with extension dependencies that aren't quite 'e'

Abhijit Menon-Sen <ams@2ndquadrant.com>

From: Abhijit Menon-Sen <ams@2ndQuadrant.com>
To: pgsql-hackers@postgresql.org
Date: 2016-03-01T01:27:45Z
Lists: pgsql-hackers

Attachments

At 2016-01-18 11:08:19 +0530, ams@2ndQuadrant.com wrote:
>
> I'm proposing to address a part of that problem by allowing extension
> dependencies to be explicitly declared for functions and objects
> created either by a user or dynamically by the extension itself—things
> that need the extension to function, but aren't a part of it.

I didn't hear any further suggestions, so here's a patch for discussion.

1. This adds the 'x'/DEPENDENCY_AUTO_EXTENSION type.
2. This adds an 'ALTER FUNCTION … ADD DEPENDENT FUNCTION …' command.

I split up the two because we may want the new dependency type without
going to the trouble of adding a new command. Maybe extension authors
should just insert an 'x' row into pg_depend directly?

I was inclined to implement it using ALTER FUNCTION, but AlterFunction()
is focused on altering the pg_proc entry for a function, so the new code
didn't fit. Ultimately, ExecAlterExtensionContentsStmt() was the closest
match, so that's where I did it.

Comments welcome. I'll add this patch to the CF.

-- Abhijit

Commits

  1. Support ALTER THING .. DEPENDS ON EXTENSION