Search Postgresql Archives

function null composite behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux