X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 57CE7310BCD for ; Wed, 2 Jul 2003 02:26:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 71858-05 for ; Tue, 1 Jul 2003 23:26:01 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 66E2431062B for ; Tue, 1 Jul 2003 23:26:00 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1817028; Tue, 01 Jul 2003 18:55:59 -0700 Message-ID: <3F0242A1.7090306@joeconway.com> Date: Tue, 01 Jul 2003 19:25:37 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alon Noy Cc: pgsql-sql@postgresql.org Subject: Re: passing a record as a function argument in pl/pgsql References: <000101c33faf$6cffb570$2201a8c0@pluto> In-Reply-To: <000101c33faf$6cffb570$2201a8c0@pluto> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200307/30 X-Sequence-Number: 14144 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