Pg/SQL returning composite type

From: "P(dot) Broennimann" <peter(dot)broennimann(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Pg/SQL returning composite type
Date: 2012-11-16 09:46:45
Message-ID: CACm4aU8hkp5c8_Y+oq4BWxgDdZGcLPihi2UfG3K0je=PWBkCxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there

I have in schema "core":

CREATE OR REPLACE FUNCTION core.f_read
(
...
)
RETURNS core.c_result_type AS
$$
declare
c_result core.c_result_type%rowtype;
begin
...
return c_result;
end
...

CREATE TYPE core.c_result_type AS (
a_value text,
a_result_code integer,
a_result text,
a_time integer
);

And in schema "canu":

CREATE OR REPLACE FUNCTION canu.f_read
(
...
)
RETURNS canu.c_result_type AS
$$
declare
c_result canu.c_result_type%rowtype;
begin
select core.f_read(...) into c_result;
return c_result;
end
...

CREATE TYPE canu.c_result_type AS (
a_value text,
a_result_code integer,
a_result text,
a_time integer
);

When calling core.f_read() the result is fine. When calling canu.f_read() I
get all values back together/concatenated in the first "a_value" field!?

What am I doing wrong here? I am using PG 9.1.6 under Ubuntu 10.04/64

Thanks & cheers,
Peter

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2012-11-16 09:58:58 Re: Pg/SQL returning composite type
Previous Message Sébastien Lardière 2012-11-16 09:09:32 Re: Plproxy with returns table() make PG segfault