Re: updated patch for foreach stmt
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Dunstan <andrew@dunslane.net>, Robert Haas <robertmhaas@gmail.com>, Stephen Frost <sfrost@snowman.net>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Takahiro Itagaki <itagaki.takahiro@gmail.com>
Date: 2011-02-16T04:45:19Z
Lists: pgsql-hackers
2011/2/16 Tom Lane <tgl@sss.pgh.pa.us>: > Andrew Dunstan <andrew@dunslane.net> writes: >> On 02/15/2011 08:59 PM, Robert Haas wrote: >>> Anyhoo, forcing the explicit ARRAY keyword in there seems like pretty >>> cheap future-proofing to me. YMMV. > >> If this is the syntax that makes you do things like: >> FOREACH foo IN ARRAY ARRAY[1,2,3] >> I have to say I find that pretty darn ugly still. > > Yeah, that was the argument against requiring ARRAY. So it comes down > to whether you think we need future-proofing here. I can't immediately > see any reason for us to need a keyword right there, but ... the combination of two keywords isn't nice, but we can ensure so result of expression will has a requested type. It's more verbose, it's more secure. We can to check a allowed keywords like SCALING in compile time, we can use a more keywords - A hash type can need a separation between KEY and VALUE - so any keyword there enables a higher possibilities in future. We can do it without a auxiliary keyword too, but parser will be more complex. Regards Pavel Stehule > > regards, tom lane >