Re: [HACKERS] WITH clause in CREATE STATISTICS - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: [HACKERS] WITH clause in CREATE STATISTICS
Date
Msg-id 724d39fc-b7e9-7634-21e1-ebdba6f73bd6@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] WITH clause in CREATE STATISTICS  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] WITH clause in CREATE STATISTICS
Re: [HACKERS] WITH clause in CREATE STATISTICS
Re: [HACKERS] WITH clause in CREATE STATISTICS
List pgsql-hackers
On 04/21/2017 12:13 AM, Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
>> Simon just pointed out that having the WITH clause appear in the middle
>> of the CREATE STATISTICS command looks odd; apparently somebody else
>> already complained on list about the same.  Other commands put the WITH
>> clause at the end, so perhaps we should do likewise in the new command.
>
>> Here's a patch to implement that.  I verified that if I change
>> qualified_name to qualified_name_list, bison does not complain about
>> conflicts, so this new syntax should support extension to multiple
>> relations without a problem.
>
> Yeah, WITH is fully reserved, so as long as the clause looks like
> WITH ( stuff... ) you're pretty much gonna be able to drop it
> wherever you want.
>
>> Discuss.
>
> +1 for WITH at the end; the existing syntax looks weird to me too.
>

-1 from me

I like the current syntax more, and  WHERE ... WITH seems a bit weird to 
me. But more importantly, one thing Dean probably considered when 
proposing the current syntax was that we may add support for partial 
statistics, pretty much like partial indexes. And we don't allow WITH at 
the end (after WHERE) for indexes:

test=# create index on t (a) where a < 100 with (fillfactor=10);
ERROR:  syntax error at or near "with"
LINE 1: create index on t (a) where a < 100 with (fillfactor=10);                                            ^
test=# create index on t (a) with (fillfactor=10) where a < 100;


regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Unportable implementation of background worker start
Next
From: Amit Langote
Date:
Subject: Re: [HACKERS] Logical replication and inheritance