function null composite behavior - Mailing list pgsql-general

From Rikard Pavelic
Subject function null composite behavior
Date
Msg-id 20151025223103.00005b0d@ngs.hr
Whole thread Raw
List pgsql-general
Hi,

I'm trying to resolve an issue in production due to difference between
composite null handling in plpgsql function.

Is there some way to get plain sql behavior regarding null composites
within plpgsql?

From the example:

create type composite as (i int);
create table data (i int, c composite);
insert into data (i) values(2);

create function plain_sql(inout id int, out d data) returns record as
$$ select id, d from data d where i = id $$ language sql;

create function plpg_sql(inout id int, out d data) returns record as
$$ begin select * into d from data where i = id; end; $$ language
plpgsql;

When I run queries (and expect the same result)

select d from plain_sql(2);
select d from plpg_sql(2);

I get: "(2,)" and "(2,"()")"

I assume there is no way to get sql like result from plpgsql
function?

Regards,
Rikard

--
Rikard Pavelic
https://dsl-platform.com/
http://templater.info/


pgsql-general by date:

Previous
From: dinesh kumar
Date:
Subject: Re: function null composite behavior
Next
From: Michael Robinson
Date:
Subject: Recurring corrupted page pointer panics on 9.4.4 hot-standby replica