Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.

Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB:        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 yet?


pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group