From: Joe Conway <mail@joeconway.com>
To: Alon Noy <anoy@arti-shock.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: passing a record as a function argument in pl/pgsql
Date: Tue, 01 Jul 2003 19:25:37 -0700
Message-ID: <3F0242A1.7090306@joeconway.com> (raw)
In-Reply-To: <000101c33faf$6cffb570$2201a8c0@pluto>
References: <000101c33faf$6cffb570$2201a8c0@pluto>
Alon Noy wrote:
> From what I tried it is possible to create such a function but it is not
> possible to call it ?!
> Can anyone provide an example?
create table foo (f1 int, f2 text);
insert into foo values(1,'a');
insert into foo values(2,'b');
insert into foo values(3,'c');
create or replace function get_foo(int) returns foo as 'select * from
foo where f1 = $1' language 'sql';
create or replace function use_foo(foo) returns text as '
declare
v_foo alias for $1;
begin
return v_foo.f2;
end;
' language 'plpgsql';
regression=# select use_foo(get_foo(2));
use_foo
---------
b
(1 row)
HTH,
Joe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mail@joeconway.com, anoy@arti-shock.com
Subject: Re: passing a record as a function argument in pl/pgsql
In-Reply-To: <3F0242A1.7090306@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox