From: dvd@gnx.it
To: pgsql-bugs@postgresql.org
Cc: dvd@gnx.it
Subject: BUG #14834: quote_literal and composite types, different behaviour between sql and plpgsql
Date: Thu, 28 Sep 2017 15:35:17 +0000
Message-ID: <20170928153517.28566.91850@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14834
Logged by: David Mugnai
Email address: dvd@gnx.it
PostgreSQL version: 9.4.7
Operating system: Linux
Description:
I found that `quote_literal` behaviour is wrong when used in a plpgsql
function over a null composite type, let me show:
create type t as (x text);
create function f(val t default null) returns text as $$
select quote_literal(val);
$$ language sql stable;
create function f2(val t default null) returns text as $$
declare
o text;
begin
select quote_literal(val) into o;
return o;
end
$$ language plpgsql;
dvd@[local]/dvd> select f() union all select f2();
f
--------
(null)
'()'
(2 rows)
If I do not mistake the both the functions should returns NULL;
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: dvd@gnx.it
Subject: Re: BUG #14834: quote_literal and composite types, different behaviour between sql and plpgsql
In-Reply-To: <20170928153517.28566.91850@wrigleys.postgresql.org>
References: <20170928153517.28566.91850@wrigleys.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