Re: AW: SQL99 functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: AW: SQL99 functions
Date: 2000-06-27 15:15:01
Message-ID: 9931.962118901@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> writes:
>> Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
>>>> create table t1 (x int);
>>>> create function foo (out int) returns int as ...;
>>>> select foo(x) from t1;
>>
>>>> will give two columns for the result.
>>
>> You've *got* to be kidding.
>>
>> To name just one problem with that, where do I put an AS to relabel
>> the extra column?

> It gets the name of the variable ( here "out"), no way to rename it,
> but no problem since you can name the variable however you like.

What? OUT is a keyword there; I don't see any explicit name for the
function's formal parameter at all.

BTW, what happens when I use foo() in a place other than the top level
of a SELECT list?

Examples:

SELECT (CASE WHEN x > 0 THEN foo(x) ELSE 42 END) FROM table

SELECT x FROM table WHERE foo(x) > 0

Also, I still haven't figured out what INOUT is supposed to do.

There are some things that are too brain-dead to consider implementing,
whether they are in SQL99 or not, and this is sounding a lot like
one of them...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-06-27 15:23:05 Re: AW: Proposal: More flexible backup/restore via pg_dump
Previous Message Philip Warner 2000-06-27 15:08:03 Re: AW: Proposal: More flexible backup/restore via pg_dump