From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: william.burke@collins.com
Subject: BUG #16023: in PgAdmin4.13, unable to recompile functions that have "search_path" set at the function level
Date: Wed, 25 Sep 2019 21:13:26 +0000
Message-ID: <16023-c7ad13c78c572572@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16023
Logged by: William Burke
Email address: william.burke@collins.com
PostgreSQL version: 9.4.0
Operating system: Windows 10 64bit
Description:
Our company has been adding the search_path to all of our functions in order
to tighten up security by using the following syntax in psql - notice I do
not add single quotes around the search_path values:
ALTER FUNCTION function_name(text, text, text) SET search_path=schema1,
pg_temp;
This works fine, however, when we then open the function in pgAdmin 4.13 (by
right clicking on the function from the pgAdmin browser window and choosing
Scripts -> CREATE Script), it is displaying the search path with single
quotes around it (they were added by pgAdmin4 query tool window), as shown
in the sample function below. This throws an error on our "custom type
variable" inside the function every time we try to recompile this function.
If the single quotes around the search_path are removed, the function will
recompile fine without an error. A sample function and sample error are
provided below:
Sample Function as shown in pgAdmin4.13:
CREATE OR REPLACE FUNCTION schema1.function1(
parameter1 text,
parameter2 text,
parameter3 text)
RETURNS record
LANGUAGE 'plpgsql'
COST 100
VOLATILE SECURITY DEFINER
SET search_path='schema1, pg_temp'
AS $BODY$
DECLARE
v_typeValue customType;
END;
$BODY$;
Sample of the error message returned:
ERROR: type "customType" does not exist
LINE 42: v_typeValue customType;
^
SQL state: 42704
Character: 1366
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: noreply@postgresql.org, william.burke@collins.com
Subject: Re: BUG #16023: in PgAdmin4.13, unable to recompile functions that have "search_path" set at the function level
In-Reply-To: <16023-c7ad13c78c572572@postgresql.org>
References: <16023-c7ad13c78c572572@postgresql.org>
* 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