pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: alexander.pavlov.rus@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path
Date: Fri, 27 Sep 2019 13:32:41 -0400
Message-ID: <20190927173241.GI31412@momjian.us> (raw)
In-Reply-To: <15993-a0c0026150beb40a@postgresql.org>
References: <15993-a0c0026150beb40a@postgresql.org>

On Fri, Sep  6, 2019 at 08:42:02PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      15993
> Logged by:          Alexander Pavlov
> Email address:      alexander.pavlov.rus@gmail.com
> PostgreSQL version: 10.9
> Operating system:   Debian
> Description:        
> 
> -- this will correctly create function with empty search_path
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL;
> 
> -- this will correctly update function to have "PUBLIC, MY_SCHEMA" search
> path
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL SET SEARCH_PATH TO PUBLIC, MY_SCHEMA;
> 
> -- this will correctly update function to have "MY_SCHEMA" search path
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL SET SEARCH_PATH TO MY_SCHEMA;
> 
> -- this will NOT update function to have empty search path, search path will
> remain "MY_SCHEMA", as at previous "create or replace" call
> CREATE OR REPLACE FUNCTION MY_FUNC () RETURNS BOOLEAN AS $$ BEGIN RETURN
> TRUE;END;$$ LANGUAGE PLPGSQL;

So you are saying that CREATE OR REPLACE FUNCTION should not preserve
the SEARCH_PATH.  Makes sense to me.  Any idea why we coded it this way?
It it part of the "OR REPLACE" goal?

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +





view thread (3+ messages)  latest in thread

Message-ID: <20190927173241.GI31412@momjian.us>
Permalink:  ../20190927173241.GI31412@momjian.us/
Also on:    postgresql.org/message-id/20190927173241.GI31412@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 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-bugs@postgresql.org
  Cc: bruce@momjian.us, alexander.pavlov.rus@gmail.com
  Subject: Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path
  In-Reply-To: <20190927173241.GI31412@momjian.us>
  References: <15993-a0c0026150beb40a@postgresql.org> <20190927173241.GI31412@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