Re: mixed, named notation support

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bernd Helmle <mailings(at)oopsware(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Steve Prentice <prentice(at)cisco(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: mixed, named notation support
Date: 2009-08-04 18:22:05
Message-ID: 162867790908041122meb13541xd84cc789cdfd8da8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/8/4 Bernd Helmle <mailings(at)oopsware(dot)de>:
> --On Montag, August 03, 2009 23:43:08 +0200 Bernd Helmle
> <mailings(at)oopsware(dot)de> wrote:
>
>> Status Report: I will finish documentation and review tomorrow and will
>> mark this patch for committer review.
>
> Here's my latest reviewed version of Pavel's patch with adjusted
> documentation per latest discussion.
>
> While poking a little bit with simplify_function() I realized that this
> patch changes the behavior of VARIADIC functions a little bit. For example:
>
> CREATE OR REPLACE FUNCTION my_test(a IN text, txt VARIADIC text[])
> RETURNS text
> AS
> $$
>  SELECT $2[1];
> $$ LANGUAGE SQL;
>
> The following doesn't work in current 8.4:
>
> SELECT my_test('abcd', ARRAY['test', 'foo']);
>
> You need to use the VARIADIC keyword to match the second argument to text[].
> However, if you are going to use named notation with the patch applied, the
> picture changes in HEAD:
>
> SELECT my_test('abcd' AS a, ARRAY['test', 'foo'] AS txt);
> my_test
> ---------
> test
> (1 row)
>
> This applies also when you reverse the argument order. I don't know wether
> this is intended, but its conflicting with what we have currently in the
> docs. It's also not clear to me wether we want this at all.
>

Named notation has different algorithm for function detection then
positional notation. There are not exist variadic parameters (because
these parameters hasn't individual names). So only "packed" variadic
parameter should be there, and this parameter have to be named - so
keyword VARIADIC is optional.

Thank You very much
Pavel

> --
>  Thanks
>
>                   Bernd

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-04 19:14:45 Re: the case for machine-readable error fields
Previous Message Tom Lane 2009-08-04 18:20:23 Re: the case for machine-readable error fields