On 2/16/15 9:43 PM, Kyotaro HORIGUCHI wrote:
> Hello, I had a look on gram.y and found other syntaxes using WITH
> option clause.
>
> At Wed, 11 Feb 2015 14:34:17 -0600, Jim Nasby<Jim.Nasby@BlueTreble.com> wrote in<54DBBCC9.1020206@BlueTreble.com>
>> >I suspect at least some of this stems from how command line programs
>> >tend to process options before arguments. I tend to agree with you
>> >Tom, but I think what's more important is that we're consistent. COPY
>> >is already a bit of an oddball because it uses WITH, but both EXPLAIN
>> >and VACUUM use parenthesis immediately after the first
>> >verb. Introducing a parenthesis version that goes at the end instead
>> >of the beginning is just going to make this worse.
>> >
>> >If we're going to take a stand on this, we need to do it NOW, before
>> >we have even more commands that use ().
>> >
>> >I know you were worried about accepting options anywhere because it
>> >leads to reserved words, but perhaps we could support it just for
>> >EXPLAIN and VACUUM, and then switch to trailing options if people
>> >think that would be better.
> I agree with the direction, but I see two issues here; how many
> syntax variants we are allowed to have for one command at a time,
> and how far we should/may extend the unified options syntax on
> other commands.
>
>
> Let me put the issues aside for now, VACUUM can have trailing
> options naturally but it seems to change, but, IMHO, EXPLAIN
> should have the target statement at the tail end. Are you
> thinking of syntaxes like following?
>
> VACUUM [FULL] [FREEZE] ... [ANALYZE] [tname [(cname, ...)]
> | VACUUM [({FULL [bool]|FREEZE [bool]|...}[,...])] [tname [(cname, ...)]
> | VACUUM [tname [(cname, ...)] [[WITH ]({FULL [bool]|FREEZE [bool]|...})]
>
> REINDEX [{INDEX|TABLE|...}] name [[WITH] (VERBOSE [bool]|...)]
>
> EXPLAIN [[WITH] ({ANALYZE [bool]|VERBOSE [bool]|... [,...]})] <statement>
>
> For concrete examples, the lines prefixed by asterisk are in new
> syntax.
If I could choose only one for explain, I would find it easier to be up
front. That way you do the explain part on one line and just paste the
query after that.
> VACUUM FULL table1;
> VACUUM ANALYZE table1 (col1);
> VACUUM (ANALYZE, VERBOSE) table1 (col1);
> *VACUUM table1 WITH (FREEZE on)
> *VACUUM table1 (cola) WITH (ANALYZE)
> *VACUUM table1 WITH (ANALYZE)
> *VACUUM table1 (FREEZE on)
>
> The fifth example looks quite odd.
I don't think we need to allow both () and WITH... I'd say one or the
other, preferably ().
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com