From: | Bryn Llewellyn <bryn(at)yugabyte(dot)com> |
---|---|
To: | Tom Lane PostgreSQL <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: "create function... depends on extension..." not supported. Why? |
Date: | 2022-04-27 03:18:47 |
Message-ID: | A3925D7F-521B-4DE6-8111-3CFB43D1F513@yugabyte.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> tgl(at)sss(dot)pgh(dot)pa(dot)us wrote:
>
>> bryn(at)yugabyte(dot)com wrote:
>>
>> The discussion has diverging threads and very many turns. I think that I managed to skim through the entire tree. As I read it, the discussion was entirely about the semantics of the proposed dependency of a function (or procedure) upon an extension. The idea to establish such a dependency using “alter function” came up quite early in the discussion. It seems that establishing it at “create function” time was never considered.
>
> Probably not. Just for the record, it's not true that CREATE and ALTER always have the same set of options. An obvious counterexample is that you can't set the owner to someone different from yourself during CREATE. There may be others.
>
> I suppose that "DEPENDS ON EXTENSION" was modeled after the commands to control extension membership, which likewise exist only in ALTER form because CREATE's behavior for that is hard-wired. If you wanted to hand-wave a lot, you could maybe claim that ownership and extension membership/dependency are similar kinds of relationships and so it makes sense that the command structures for manipulating them are similar. But TBH that would probably be reverse-engineering an explanation. I think that "we didn't bother" is more nearly the situation.
Thanks, Tom. Just as I’d hoped, I found your “we didn’t bother” reply very helpful. I take your point about the inevitability of some differences between what “create function” and “alter function” can express.
B.t.w., in Oracle Database, you can create a schema object with any owner as long as you have the object-type-specific “ANY” privilege. (You need an ordinary object-type-specific privilege just to create objects that you own yourself.) The PG model is as different from the Oracle model as it could be in the general area of creating, altering, and dropping schema objects. I see that “alter” to change the owner only after the fact, requiring as it does a superuser, is [almost] a forced choice in PG.
It would seem, though, that syntax could be invented to allow a superuser to create an object of any type with any owner. But I s’pose that the usability benefit that this would bring would be marginal and it might even tempt bad practices.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2022-04-27 04:21:07 | Re: Fresh eyeballs needed: input into error [FIXED] |
Previous Message | Bruce Momjian | 2022-04-27 03:11:46 | Re: Fresh eyeballs needed: input into error [FIXED] |