Re: 2 questions about types

From: Jason Tesser <jtesser(at)nbbc(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: 2 questions about types
Date: 2005-03-16 16:05:15
Message-ID: 1110989115.5882.12.camel@075a-03.nmi.northlandministries.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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);

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-03-16 16:36:14 Re: 2 questions about types
Previous Message Michael Fuhr 2005-03-16 15:44:22 Re: New user: Windows, Postgresql, Python