X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A5634D1F29A for ; Thu, 6 May 2004 09:51:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46676-07 for ; Thu, 6 May 2004 09:51:37 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id CD9A7D1EB0A for ; Thu, 6 May 2004 09:51:33 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i46Cpbr7026366; Thu, 6 May 2004 08:51:37 -0400 (EDT) To: "Riccardo G. Facchini" Cc: pgsql-sql@postgresql.org Subject: Re: new and old as parameter in a function In-reply-to: <20040506122433.71668.qmail@web13908.mail.yahoo.com> References: <20040506122433.71668.qmail@web13908.mail.yahoo.com> Comments: In-reply-to "Riccardo G. Facchini" message dated "Thu, 06 May 2004 05:24:33 -0700" Date: Thu, 06 May 2004 08:51:37 -0400 Message-ID: <26365.1083847897@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/57 X-Sequence-Number: 17771 "Riccardo G. Facchini" writes: > By Reading the documentation, I understand that I can write a PLPGSQL > function that receives a parameter of type RECORD, You misread it --- that's not presently supported. regression=# create function foo(record) returns int as ' regression'# begin regression'# return $1.f1; regression'# end' language plpgsql; ERROR: plpgsql functions cannot take type record However you can make a plpgsql function that accepts a parameter of a specific (named) rowtype: regression=# create table fooey(f1 int, f2 text); CREATE TABLE regression=# create function foo(fooey) returns int as ' regression'# begin regression'# return $1.f1; regression'# end' language plpgsql; CREATE FUNCTION regards, tom lane