pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Erki Eessaar <erki.eessaar@taltech.ee>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Cc: Noah Misch <noah@leadboat.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely
Date: Fri, 7 Oct 2022 10:02:22 -0400
Message-ID: <Y0Axbu5hdZtJ1NgR@momjian.us> (raw)
In-Reply-To: <AM9PR01MB8268561F390A27AE8C56F9B6FE5F9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
References: <AM9PR01MB8268BF5E74E119828251FD34FE409@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
	<Yvvw1JB/Y12HvAYn@momjian.us>
	<YzR/X5Hhyu4HaUj2@momjian.us>
	<AM9PR01MB8268FB1629B5AAF1680E0594FE5C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
	<Y0ArNYxcHbimR6zN@momjian.us>
	<AM9PR01MB8268561F390A27AE8C56F9B6FE5F9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>

On Fri, Oct  7, 2022 at 01:50:14PM +0000, Erki Eessaar wrote:
> Hello
> 
> Another example where explicit search path is needed.
> 
> CREATE TABLE public.B(b INTEGER);
> CREATE TABLE pg_temp.B(b INTEGER);
> 
> CREATE OR REPLACE FUNCTION f3 () RETURNS VOID
> LANGUAGE sql SECURITY DEFINER
> BEGIN ATOMIC
> INSERT INTO B(b) VALUES (1);
> END;
> 
> SELECT f3();
> 
> SELECT * FROM public.B;
> /*Result has 0 rows.*/
> 
> SELECT * FROM pg_temp.B;
> /*Result has 1 row. Function f3 was associated with pg_temp.B because
> f3() did not have explicitly set search path.*/
> 
> I see now that there are multiple reasons why to still use search path. I agree
> now that this extra paragaraph is perhaps too confusing and is not needed.

Thanks.  I learned a few things in this discussion and we can revisit it
if we feel there is need of improvement.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson






view thread (14+ messages)  latest in thread

Message-ID: <Y0Axbu5hdZtJ1NgR@momjian.us>
Permalink:  ../Y0Axbu5hdZtJ1NgR@momjian.us/
Also on:    postgresql.org/message-id/Y0Axbu5hdZtJ1NgR@momjian.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, erki.eessaar@taltech.ee, pgsql-docs@lists.postgresql.org, noah@leadboat.com, peter.eisentraut@enterprisedb.com
  Subject: Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely
  In-Reply-To: <Y0Axbu5hdZtJ1NgR@momjian.us>

* 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