Re: 2 questions about types

Поиск
Список
Период
Сортировка
От Jason Tesser
Тема Re: 2 questions about types
Дата
Msg-id 1110989115.5882.12.camel@075a-03.nmi.northlandministries.org
обсуждение исходный текст
Ответ на Re: 2 questions about types  (Richard Huxton <dev@archonet.com>)
Ответы Re: 2 questions about types  (Richard Huxton <dev@archonet.com>)
Список 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 по дате отправления:

Предыдущее
От: Harald Fuchs
Дата:
Сообщение: Re: plPerl subroutine
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: 2 questions about types