Re: Function returns composite type

From: Joe Conway <mail(at)joeconway(dot)com>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function returns composite type
Date: 2003-06-10 17:36:18
Message-ID: 3EE61712.8@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev wrote:
> Ok, RECORD was a keyword, thank you. But I have questions:
> 1 What do you mean SRF? Set Return Function?

It refers to functions returning one or more tuples. From a practical
standpoint, it is a function that is (and must be) used in the FROM
clause like a table (hence also known as a "table function").

> # select * from qqn(1,2) as c(qq int4, qq1 int4);
> qq | qq1
> ----+-----
> 1 | 2
> (1 row)
>
> It works fine. But is there way not to point 'as c(qq int4, qq1 int4)'?

If you mean, is there a way to leave out the 'as c(qq int4, qq1 int4)',
the answer is no. You need to either declare the function to return a
determinate data type, or you have to specify the data type at runtime
in the query string.

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-06-10 17:45:09 Re: Groups and roles
Previous Message Martin D. Weinberg 2003-06-10 17:32:53 Re: [GENERAL] Postgresql & AMD x86-64