Documentation regarding %ROWTYPE in PL/PgSQL

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Documentation regarding %ROWTYPE in PL/PgSQL
Date: 2002-05-27 09:43:47
Message-ID: 1022492628.22442.1407.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I recently referred to the manual (section 23.3) to work out how to
write a PL/PgSQL function that accepted a row as a parameter.

Reading between a few lines I got the impression that the manual
suggested something like:

CREATE or REPLACE myfunc( tablename%ROWTYPE ) RETURNS ...

When I finally got my function working, I found I had:

CREATE or REPLACE myfunc( tablename ) RETURNS ...

This is brilliant :-), and in fact the manual foreshadows it:

"although one might expect a bare table name to work as a type
declaration, it won't be accepted within
<application>PL/pgSQL</application> functions."

So I guess the manual needs a little update there, or perhaps the syntax
that I used only works in the variable list, so I was lucky.

I would happily supply a patch to the documentation myself, except that
I don't really know what the correct answer is! The docs get a bit hazy
in this area regarding the differences between function parameters,
declared variables and declared aliases.

If someone wants to supply me with the lowdown (or tell me who they are
and I can quiz them :-) then I will produce a patch for this area.

I'm doing this under 7.2.1, but I've checked CVS as far as I am able and
this appears not to have changed.

Regards,
Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Are you enrolled at http://schoolreunions.co.nz/ yet?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mathieu Arnold 2002-05-27 12:36:08 Re: pg_dump && aggregate bug
Previous Message pgsql-bugs 2002-05-27 02:56:22 Bug #679: Time input format is no longer ISO 8601 compliant