pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryn Llewellyn <bryn@yugabyte.com>
To: Karsten Hilbert <Karsten.Hilbert@gmx.net>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: Surprising results from current_role in a "security invoker" trigger function in a "cascade delete via FK" scenario
Date: Thu, 11 Aug 2022 09:28:52 -0700
Message-ID: <98604D47-FBA4-41FF-93D0-96167F1EC14D@yugabyte.com> (raw)
In-Reply-To: <trinity-41237384-5ec3-4343-8b77-937db0da5571-1660205456685@3c-app-gmx-bs36>
References: <6EA46B7D-7775-4524-96EC-E32599AA46EC@yugabyte.com>
	<CAKFQuwZsOpj7eQM=W2FpGo3LeoBaRv7o5GuMBDbTY94t9s2vdA@mail.gmail.com>
	<615A1F2A-EB13-43D8-A97C-6344DD9C892F@yugabyte.com>
	<trinity-41237384-5ec3-4343-8b77-937db0da5571-1660205456685@3c-app-gmx-bs36>

> Karsten.Hilbert@gmx.net wrote:
> 
>> bryn@yugabyte.com wrote:
>> 
>> I'll be happy to make a smaller example. It will, however, need to create… After all, how would I know which of the eight to skip while I don't know the intended rules for the current_role?
> 
> You'd certainly start out with all eight but then whittle down to what still exhibits the problem and post that.

Do you know where I can read a statement of the intended rules here? I appreciate that one is doomed who tries to deduce the rules that govern a software system's behavior by using just empirical testing. (And reading source code hoping to deduce the behavior that the programmer intended is hardly better.)

I used the subject "surprising results" to mean "Results that surprise me, Bryn". The results might well not surprise somebody who knows the rules. Several cases that I've asked about before on this list were surprising for me because I was too dim-witted to find where, in the PG docs, the rules were stated. And in those cases, I was delighted to be pointed to the appropriate doc and to receive some helpful instruction. That's what I'm hoping for here.

Notice that I didn't consider "for insert" or "for update" triggers. But you can contrive a cascade effect with these, too. For example, table "t1" might have a trigger that inserts or updates a row in table "t2" for a purpose like maintaining a change history. And "t2" might, in turn, have a trigger for who-knows-what purpose (maybe to enforce a write-once-read-many regime for the values in certain columns).

This is why I'd very much like to start by studying a clear statement of the intention in scenarios in the same general class as the one that I showed.=

view thread (14+ messages)  latest in thread

Message-ID: <98604D47-FBA4-41FF-93D0-96167F1EC14D@yugabyte.com>
Permalink:  ../98604D47-FBA4-41FF-93D0-96167F1EC14D@yugabyte.com/
Also on:    postgresql.org/message-id/98604D47-FBA4-41FF-93D0-96167F1EC14D@yugabyte.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: bryn@yugabyte.com, Karsten.Hilbert@gmx.net, david.g.johnston@gmail.com
  Subject: Re: Surprising results from current_role in a "security invoker" trigger function in a "cascade delete via FK" scenario
  In-Reply-To: <98604D47-FBA4-41FF-93D0-96167F1EC14D@yugabyte.com>
  References: <6EA46B7D-7775-4524-96EC-E32599AA46EC@yugabyte.com> <CAKFQuwZsOpj7eQM=W2FpGo3LeoBaRv7o5GuMBDbTY94t9s2vdA@mail.gmail.com> <615A1F2A-EB13-43D8-A97C-6344DD9C892F@yugabyte.com> <trinity-41237384-5ec3-4343-8b77-937db0da5571-1660205456685@3c-app-gmx-bs36> <98604D47-FBA4-41FF-93D0-96167F1EC14D@yugabyte.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox