Re: Functions returns to libpq with wrong column split

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andy Halsall <halsall_andy(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Functions returns to libpq with wrong column split
Date: 2011-10-18 23:45:48
Message-ID: 27718.1318981548@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Andy Halsall <halsall_andy(at)hotmail(dot)com> writes:
> My stored procedure looks like this:

> CREATE OR REPLACE FUNCTION readnode4(bigint) RETURNS appexcatdata AS '
> declare
> h appexcatdata;
> begin
> select INTO h r.user_data, n.system_data FROM relationship r INNER JOIN node_system n ON n.node_id = r.node_id WHERE r.node_id = $1 LIMIT 1;
> RETURN h;
> end
> '
> language 'plpgsql';

[ which is queried as ]

> "SELECT readnode4($1)",

I think you probably want "SELECT * FROM readnode4($1)". As-is,
you're getting a single composite-type column from the SELECT.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Andy Halsall 2011-10-19 08:45:38 Re: Functions returns to libpq with wrong column split
Previous Message Dournaee, Blake 2011-10-18 19:41:52 enterprise support