Re: WIP: default values for function parameters - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: WIP: default values for function parameters
Date
Msg-id 162867790812090622u148273cau9e3a80a6fa5b355@mail.gmail.com
Whole thread Raw
In response to Re: WIP: default values for function parameters  (Grzegorz Jaskiewicz <gj@pointblue.com.pl>)
Responses Re: WIP: default values for function parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
2008/12/9 Grzegorz Jaskiewicz <gj@pointblue.com.pl>:
> Ok, how about
>
> CREATE FUNCTION FOO (one int, two float8 default 3.14, three int[] default
> '{6,7,8,90}')....;
>
> and than SELECT FOO( 777, DEFAULT, '{1,2,3,4,5}');
>
> I have no idea what SQL standard says in that case, all I know is that
> keyword DEFAULT exists in it, and is used in queries for similar purpose.
>
>

SQL standard don't say anything. Leader (in this topic)  is Oracle,
and there is for this case "mixed notation" (google) -

select foo(777, three=> '{1,2,3,4,5});

it's more safe and more readable.

I did some test, and I thing so it is implementable. I had to solve
problem with hstore module. There is defined operator => too, what is
bad. But we can implemented in transformation and it should by
disabled via GUC, so it's solveable.

reagards
Pavel Stehule


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Quick patch: Display sequence owner
Next
From: Tom Lane
Date:
Subject: Re: cvs head initdb hangs on unixware