I see mention in SQL99 of function definitions which can have IN, OUT,
and INOUT arguments. Any thoughts on how this could be supported in
Postgres? I assume that we would need to figure out how to generate
multi-element tuples from the usual function calls, but wouldn't this
dovetail with getting better SET return capabilities too?

                   - Thomas

Tue, 27 Jun 2000 02:41:18 +0000
Thomas Lockhart <lockhart@alumni.caltech.edu>
SQL99 functions
Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> I see mention in SQL99 of function definitions which can have IN, OUT,
> and INOUT arguments. Any thoughts on how this could be supported in
> Postgres?

I noticed that but haven't quite figured out how it's supposed to fit
into the SQL worldview at all.  Surely
	SELECT foo(x) FROM table
shouldn't silently mutate into an UPDATE depending on how foo() is
declared.  Exactly where is a function with OUT args useful in SQL?

			regards, tom lane

Tue, 27 Jun 2000 04:51:15 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: SQL99 functions 
> > I see mention in SQL99 of function definitions which can have IN, 
> > OUT, and INOUT arguments. Any thoughts on how this could be 
> > supported in Postgres?
> I noticed that but haven't quite figured out how it's supposed to fit
> into the SQL worldview at all.  Surely
>         SELECT foo(x) FROM table
> shouldn't silently mutate into an UPDATE depending on how foo() is
> declared.  Exactly where is a function with OUT args useful in SQL?

  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.

  create function foo (inout int) returns int as ...;
  select foo(x) from t1;

will mutate the result, but not the underlying stored value of t1.x.

Beware, I haven't yet confirmed this by reading ;)

                     - Thomas

Tue, 27 Jun 2000 13:45:29 +0000
Thomas Lockhart <lockhart@alumni.caltech.edu>
Re: SQL99 functions
Thomas Lockhart <lockhart@alumni.caltech.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?

			regards, tom lane

Tue, 27 Jun 2000 10:14:37 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: SQL99 functions 