From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Rethinking LOCK TABLE's behavior on views |
Date: | 2020-11-09 14:42:33 |
Message-ID: | 20201109144233.GA4469@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2020-Nov-07, Noah Misch wrote:
> On Sat, Nov 07, 2020 at 11:57:20AM -0500, Tom Lane wrote:
> > A completely different approach we could consider is to weaken the
> > permissions requirements for LOCK on a view, say "allow it if either
> > the calling user or the view owner has the needed permission". This
> > seems generally pretty messy and so I don't much like it, but we
> > should consider as many solutions as we can think of.
>
> This is the best of what you've listed by a strong margin, and I don't know of
> better options you've not listed. +1 for it. Does it work for you?
It does sound attractive from a user complexity perspective, even if it
does sound messy form an implementation perspective.
> I think
> the mess arises from LOCK TABLE serving "get locks sufficient for $ACTIONS" as
> a family of use cases. For views only, different $ACTIONS want different
> behavior. $ACTIONS==SELECT wants today's behavior; pg_get_viewdef() wants
> shallower recursion and caller permissions; DROP VIEW wants no recursion.
Maybe we can tackle this problem directly, by adding a clause to LOCK
TABLE to indicate a purpose for the lock that the server can use to
determine the level of recursion. For example
LOCK TABLE xyz IN <mode> FOR <purpose>
where <purpose> can be READ, DROP, DEFINE.
(For back-patch purposes we could store the purpose in LockStmt->mode,
which has more than enough unused bits).
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2020-11-09 14:47:22 | Re: pg_upgrade analyze script |
Previous Message | Magnus Hagander | 2020-11-09 14:35:28 | Re: Prevent printing "next step instructions" in initdb and pg_upgrade |