logo       

Re: anonymous composite types for Table Functions (aka SRFs): msg#00290

Subject: Re: anonymous composite types for Table Functions (aka SRFs)
On Sun, Jul 28, 2002 at 10:24:34PM -0700, Joe Conway wrote:
> Attached are two patches to implement and document anonymous composite 
> types for Table Functions, as previously proposed on HACKERS.

Nice work!

> 1. Creates a new pg_type typtype: 'p' for pseudo type (currently either
>     'b' for base or 'c' for catalog, i.e. a class).

I think you mentioned that typtype could be renamed to typkind -- that
sounds good to me...

> When creating a function you can do:
>     CREATE FUNCTION foo(text) RETURNS setof RECORD ...
> 
> When using it you can do:
>     SELECT * from foo(sqlstmt) AS (f1 int, f2 text, f3 timestamp)

Is there a reason why you can't specify the return type in the function
declaration? ISTM that for most functions, the 'AS' clause will be the
same for every usage of the function.

On a related note, it is possible for the table function to examine the
attributes it has been asked to return, right? Since the current patch
requires that every call specify the return type, it might be possible
to take advantage of that to provide semi-"polymorphic" behavior
(i.e. the function behaves differently depending on the type of data
the user asked for)

>     SELECT * from foo(sqlstmt) AS f(f1 int, f2 text, f3 timestamp)

What does the 'f' indicate?

>     SELECT * from foo(sqlstmt) f(f1 int, f2 text, f3 timestamp)

This form of the syntax seems a bit unclear, IMHO. It seems a bit
like two function calls. Can the 'AS' be made mandatory?

Cheers,

Neil

-- 
Neil Conway <neilconway@xxxxxxxxxx>
PGP Key ID: DB3C29FC

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe