BUG #14834: quote_literal and composite types, different behaviour between sql and plpgsql

From: dvd(at)gnx(dot)it
To: pgsql-bugs(at)postgresql(dot)org
Cc: dvd(at)gnx(dot)it
Subject: BUG #14834: quote_literal and composite types, different behaviour between sql and plpgsql
Date: 2017-09-28 15:35:17
Message-ID: 20170928153517.28566.91850@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14834
Logged by: David Mugnai
Email address: dvd(at)gnx(dot)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(at)[local]/dvd> select f() union all select f2();
f
--------
(null)
'()'
(2 rows)

If I do not mistake the both the functions should returns NULL;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message nicola.contu 2017-09-28 15:46:51 BUG #14835: Postgres crashed
Previous Message David G. Johnston 2017-09-28 15:27:28 Re: Row security policies using session variable can be circumvented