Re: WIP: default values for function parameters

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Grzegorz Jaskiewicz" <gj(at)pointblue(dot)com(dot)pl>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: WIP: default values for function parameters
Date: 2008-12-09 14:22:09
Message-ID: 162867790812090622u148273cau9e3a80a6fa5b355@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/12/9 Grzegorz Jaskiewicz <gj(at)pointblue(dot)com(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-09 14:23:06 Re: cvs head initdb hangs on unixware
Previous Message Alvaro Herrera 2008-12-09 14:20:15 Re: Quick patch: Display sequence owner