pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: sad <sad@bankir.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: how to call a function with row-type arg
Date: Fri, 12 Sep 2003 09:57:54 -0400
Message-ID: <10528.1063375074@sss.pgh.pa.us> (raw)
In-Reply-To: <200309120931.13760.sad@bankir.ru>
References: <200309120931.13760.sad@bankir.ru>

sad <sad@bankir.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



view thread (3+ messages)

Message-ID: <10528.1063375074@sss.pgh.pa.us>
Permalink:  ../10528.1063375074@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10528.1063375074@sss.pgh.pa.us

 · 

reply

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, sad@bankir.ru
  Subject: Re: how to call a function with row-type arg
  In-Reply-To: <10528.1063375074@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