Re: 2 questions about types - Mailing list pgsql-general

From Jason Tesser
Subject Re: 2 questions about types
Date
Msg-id 1110989115.5882.12.camel@075a-03.nmi.northlandministries.org
Whole thread Raw
In response to Re: 2 questions about types  (Richard Huxton <dev@archonet.com>)
Responses Re: 2 questions about types  (Richard Huxton <dev@archonet.com>)
List pgsql-general
<snip>
>
> There's an example in the manuals - chapter "7.2.1.4. Table Functions"
>
> SELECT *
>      FROM dblink('dbname=mydb', 'select proname, prosrc from pg_proc')
>        AS t1(proname name, prosrc text)
>      WHERE proname LIKE 'bytea%';
>
> So basically, you need to supply the type definitions in your SELECT if
> you aren't going to supply it in the function definition.

ok I tried to rewrite as follows but I get an error that says "a column
definition list is required fro functions returning record

here is my function and call for it now
CREATE OR REPLACE FUNCTION "public"."loginbyindidgettest" (integer)
RETURNS SETOF "pg_catalog"."record" AS'
declare

iindid alias for $1;
returnRec RECORD;

begin

for returnRec in select t1.indid, t1.title, t1.firstname, t1.middlename,
t1.lastname, t1.suffix, t1.loginname, t1.loginnameid, t1.ad,t1.current,
t1.email, t1.note
from tblindividual inner join tblloginname on (tblindividual.indid =
tblloginname.indlink) as t1
where tblloginname.indlink = iindid
order by tblindividual.lastname, tblindividual.firstname,
tblindividual.middlename, tblloginname.loginname
loop
             return next returnRec;
     end loop;
     return;
end;
'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

select * from loginbyindidgettest(43650);



pgsql-general by date:

Previous
From: Harald Fuchs
Date:
Subject: Re: plPerl subroutine
Next
From: Richard Huxton
Date:
Subject: Re: 2 questions about types