Re: Passing RECORD variable from func1() to func2()
От | Henry Combrinck |
---|---|
Тема | Re: Passing RECORD variable from func1() to func2() |
Дата | |
Msg-id | 52795.165.165.166.163.1094543085.squirrel@airmail.metroweb.co.za обсуждение исходный текст |
Ответ на | Re: Passing RECORD variable from func1() to func2() (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Passing RECORD variable from func1() to func2()
|
Список | pgsql-general |
Thanks for the CREATE TYPE samples. *Using* the custom types seems to be a problem (or rather, I'm using it incorrectly). The following code fails with the error message "WARNING: Error occurred while executing PL/pgSQL function f_test00 WARNING: line 8 at SQL statement ERROR: Attribute "rec1" not found" /* create same columns as table1 */ create type TYPE_T1 as (col1 int, col2 int,... etc); CREATE or replace FUNCTION f_test01 (TYPE_T1) RETURNS int AS ' declare temprec alias for $1 begin raise notice ''eid: % pcyc: %'', temprec.col1, temprec.col2; return 0; end; ' LANGUAGE 'plpgsql'; CREATE or replace FUNCTION f_test00 () RETURNS int AS ' declare rec1 TYPE_T1%ROWTYPE; begin for rec1 in select * from table1 loop select f_test01(rec1); /* this is where it fails. */ end loop; return 0; end; ' LANGUAGE 'plpgsql'; -------------------------------------------------------- This message was sent using MetroWEB's AirMail service. http://www.metroweb.co.za/ - full access for only R73. Free Web Accelerator, WebMail, Calendar, Anti-Virus, Anti-Spam, 10 emails, 100MB personal webspace, and more! Phone Now! 086 11 11 440
В списке pgsql-general по дате отправления: