Digging gram.y

Started by Teodor Sigaevover 19 years ago5 messages
#1Teodor Sigaev
teodor@sigaev.ru

In gram.y
Typename: SimpleTypename opt_array_bounds
{
$$ = $1;
$$->arrayBounds = $2;
}
| SETOF SimpleTypename opt_array_bounds
{
$$ = $2;
$$->arrayBounds = $3;
$$->setof = TRUE;
}

Typename is a generic name of type and it used in many places in gram.c, but
AFAIK the single place with SETOF is a function's RETURNS declaration. So there
is many checks about SETOF. May I eliminate SETOF from Typename and leave it
only for RETURNS?

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Teodor Sigaev (#1)
Re: Digging gram.y

Teodor Sigaev <teodor@sigaev.ru> writes:

May I eliminate SETOF from Typename and leave it
only for RETURNS?

Why do you want to?

I think the reason it's in Typename is the assumption that in future
we would try to extend the applicability of SETOF, not restrict it.
For instance I can see reasons for wanting SETOF on a function's input
parameter (to pass it a whole table or select result in one call).

regards, tom lane

#3Teodor Sigaev
teodor@sigaev.ru
In reply to: Tom Lane (#2)
Re: Digging gram.y

Why do you want to?

Just simplify.

For instance I can see reasons for wanting SETOF on a function's input
parameter (to pass it a whole table or select result in one call).

I see. But Typename is used for table's definition for example. I can't imagine
column "setof text".

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Teodor Sigaev (#3)
Re: Digging gram.y

Teodor Sigaev <teodor@sigaev.ru> writes:

Why do you want to?

Just simplify.

I think you'd just be moving the complexity somewhere else.

regards, tom lane

#5David Fetter
david@fetter.org
In reply to: Teodor Sigaev (#3)
Re: Digging gram.y

On Wed, Oct 04, 2006 at 09:04:11PM +0400, Teodor Sigaev wrote:

Why do you want to?

Just simplify.

For instance I can see reasons for wanting SETOF on a function's
input parameter (to pass it a whole table or select result in one
call).

I see. But Typename is used for table's definition for example. I
can't imagine column "setof text".

It's part of the SQL:2003 standard as MULTISET :)

Cheers,
D
--
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!