Unix Technical Forum

Digging gram.y

This is a discussion on Digging gram.y within the pgsql Hackers forums, part of the PostgreSQL category; --> In gram.y Typename: SimpleTypename opt_array_bounds { $$ = $1; $$->arrayBounds = $2; } | SETOF SimpleTypename opt_array_bounds { $$ ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 06:07 AM
Teodor Sigaev
 
Posts: n/a
Default Digging gram.y

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/

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 06:08 AM
Tom Lane
 
Posts: n/a
Default 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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-12-2008, 06:08 AM
Teodor Sigaev
 
Posts: n/a
Default 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/

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-12-2008, 06:08 AM
Tom Lane
 
Posts: n/a
Default 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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-12-2008, 06:08 AM
David Fetter
 
Posts: n/a
Default 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!

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:49 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com