From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | Feite Brekeveld <feite(dot)brekeveld(at)osiris-it(dot)nl>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: how to return more than 1 arg with a function ? |
Date: | 2001-02-17 16:22:14 |
Message-ID: | 3843.982426934@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Richard Huxton <dev(at)archonet(dot)com> writes:
> You can also return a tuple like:
> create function whole_row() returns foo as ...
> But - that can only be used to feed into another function, not in a
> "raw" select statement.
You can make a function returning tuple (or setof tuple), but there
are a whole bunch of silly little problems that restrict what you
can actually *do* with it. What it comes down to is that you probably
can't do anything useful except select a single field out of the tuple
result per function call, which leaves you wondering why you bothered.
The PostQUEL-derived syntax is bizarre, too: table.field.function.field
(where table.field is the function argument, and the second fieldname
is what you're selecting out of the function result).
We have thoughts of allowing functions returning tuples to be used as
table sources (FROM items), which would overcome the notational issues.
Maybe in 7.2 ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Richardson | 2001-02-17 17:00:37 | Function reference |
Previous Message | Eric Nicolas | 2001-02-17 15:30:54 |