pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it>
Cc: Pgsql-Sql <pgsql-sql@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: functions are returns columns
Date: Sat, 10 Nov 2007 18:14:50 -0500
Message-ID: <21435.1194736490@sss.pgh.pa.us> (raw)
In-Reply-To: <874pftdd89.fsf@oxford.xeocode.com>
References: <4734B921.5050704@unipex.it>
	<162867790711091235i7e77abcch27731d91285949b6@mail.gmail.com>
	<4735EC6F.5050908@unipex.it>
	<878x55dhau.fsf@oxford.xeocode.com>
	<19335.1194723995@sss.pgh.pa.us>
	<874pftdd89.fsf@oxford.xeocode.com>

Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> Not quite --- it's just "returns setof record".

> I did test my example before posting it:

> postgres=# postgres=# CREATE or replace FUNCTION getfoo (IN int, OUT int, OUT int) returns setof record(int,int)AS $$
>    SELECT 1,2 union all select 2,3;
> $$ LANGUAGE SQL;

Interesting --- if you try it in anything older than 8.3, it will fail.

What is happening here is that the "(int,int)" is being taken as a
typmod (per Teodor's work to allow typmods for all data types), and
apparently in this path we never check to see if it's a *valid* typmod.

Now typmods are always discarded from function argument and result
types, but it seems like we'd better validate that they're legal for the
datatype anyway.  Otherwise there will be confusion of just this sort.

Comments, objections?

			regards, tom lane



view thread (7+ messages)

Message-ID: <21435.1194736490@sss.pgh.pa.us>
Permalink:  ../21435.1194736490@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21435.1194736490@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, stark@enterprisedb.com, michele.petrazzo@unipex.it, pgsql-hackers@postgresql.org
  Subject: Re: functions are returns columns
  In-Reply-To: <21435.1194736490@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