From anoy@arti-shock.com Tue Jul 1 09:04:40 2003 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 2A30A310BFD for ; Tue, 1 Jul 2003 09:04:40 +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 25062-04 for ; Tue, 1 Jul 2003 06:04:29 -0300 (ADT) Received: from shock.propagation.net (unknown [216.97.37.217]) by svr1.postgresql.org (Postfix) with SMTP id 3A4F1310BF5 for ; Tue, 1 Jul 2003 06:04:28 -0300 (ADT) Received: (qmail 29956 invoked from network); 1 Jul 2003 08:51:38 -0000 Received: from f67037.upc-f.chello.nl (HELO pluto) (80.56.67.37) by 0 with SMTP; 1 Jul 2003 08:51:38 -0000 From: "Alon Noy" To: Subject: passing a record as a function argument in pl/pgsql Date: Tue, 1 Jul 2003 11:01:22 +0200 Message-ID: <000101c33faf$6cffb570$2201a8c0@pluto> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0002_01C33FC0.30888570" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Archive-Number: 200307/24 X-Sequence-Number: 14138 This is a multi-part message in MIME format. ------=_NextPart_000_0002_01C33FC0.30888570 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Is it possible? >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? Tnx. ------=_NextPart_000_0002_01C33FC0.30888570 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Is it possible?

 

From what I tried it is possible to create such a functi= on but it is not possible to call it ?!<= /span>

Can anyone provide an example?<= /p>

 

Tnx<= /font>.

 

------=_NextPart_000_0002_01C33FC0.30888570-- From mail@joeconway.com Wed Jul 2 02:26:11 2003 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