Re: how to call a function with row-type arg

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sad <sad(at)bankir(dot)ru>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to call a function with row-type arg
Date: 2003-09-12 13:57:54
Message-ID: 10528.1063375074@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

sad <sad(at)bankir(dot)ru> writes:
> how to call a function with a row_type arg ??

> CREATE FUNCTION foo(tablename) returns int .....

SELECT foo(tablename) FROM tablename;
or
SELECT foo(tablename.*) FROM tablename;

The first is traditional Postgres usage, but I think the second makes it
more clear what's going on.

BTW, if you use a table alias then the alias is the name to refer to.

SELECT foo(x.*) FROM tablename as x;

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2003-09-12 14:12:13 Re: createlang plpgsql failing on redhatlinux7.2
Previous Message vijaykumar M 2003-09-12 13:49:36 createlang plpgsql failing on redhatlinux7.2