Re: Is this really really as designed or defined in some standard - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: Is this really really as designed or defined in some standard
Date
Msg-id 1220274503.7124.5.camel@huvostro
Whole thread Raw
In response to Re: Is this really really as designed or defined in some standard  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Responses Re: Is this really really as designed or defined in some standard
List pgsql-hackers
On Mon, 2008-09-01 at 11:15 +0200, Pavel Stehule wrote:
> 2008/9/1 Magnus Hagander <magnus@hagander.net>:
> > Pavel Stehule wrote:
> >> Hello
> >>
> >> 2008/8/31 Hannu Krosing <hannu@2ndquadrant.com>:

> >>>
> >>> hannu=# create or replace function ffa(a int, a int) returns int
> >>> language plpgsql as $$begin return a + a; end;$$;
> >>> CREATE FUNCTION
> >>> hannu=# select ffa(1,2);
> >>>  ffa
> >>> -----
> >>>   2
> >>> (1 row)
> >>>
> >>> Is this defined by some standard or just an oversight ?
> >>>
> >>
> >> what is problem? You have two diferent functions. I don't see anything wrong.
> >
> > Take a look at the second function again. It's certainly not behaviour
> > that I would expect :-) (I would expect a syntax error)
> 
> I see it now - it's really bug

There are a few places, where repeating labels are allowed, for example
select can produce such record 

hannu=# select 1 as a, 2 as a;a | a 
---+---1 | 2
(1 row)

But it is not allowed in TYPE or table definitions

hannu=# create type aa as (a int, a int); 
ERROR:  column "a" specified more than once

hannu=# create table aa (a int, a int); 
ERROR:  column "a" specified more than once

It probably is also not allowed in function/procedure argument list, but
I was not sure that any standard would not require it.

So, should this be fixed at calling / SQL side (by not allowing
repeating argument names) or at pl side for each pl separately ?

--------------
Hannu




pgsql-hackers by date:

Previous
From: "Asko Oja"
Date:
Subject: Re: Attaching error cursor position to invalid constant values
Next
From: "Marko Kreen"
Date:
Subject: Re: [PATCH] Make gram.y use palloc/pfree for memory management