From: Tom Lane <tgl@sss.pgh.pa.us>
To: Riccardo G. Facchini <abief_ag_-postgresql@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: new and old as parameter in a function
Date: Thu, 06 May 2004 08:51:37 -0400
Message-ID: <26365.1083847897@sss.pgh.pa.us> (raw)
In-Reply-To: <20040506122433.71668.qmail@web13908.mail.yahoo.com>
References: <20040506122433.71668.qmail@web13908.mail.yahoo.com>
"Riccardo G. Facchini" <abief_ag_-postgresql@yahoo.com> 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
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: tgl@sss.pgh.pa.us, abief_ag_-postgresql@yahoo.com
Subject: Re: new and old as parameter in a function
In-Reply-To: <26365.1083847897@sss.pgh.pa.us>
* 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