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

From Alvaro Herrera
Subject Re: [HACKERS] WITH clause in CREATE STATISTICS
Date
Msg-id 20170504184833.rex3v67s3gxmaqjt@alvherre.pgsql
Whole thread Raw
In response to Re: [HACKERS] WITH clause in CREATE STATISTICS  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: [HACKERS] WITH clause in CREATE STATISTICS  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Here's a patch implementing this idea.  From gram.y's comment, the
support syntax is now:

  /*****************************************************************************
   *
   *        QUERY :
!  *                CREATE STATISTICS stats_name [(stat types)] arguments
! 
!  *            where 'arguments' can be one or more of:
!  *                    { ON (columns)
!  *                      | FROM relations
!  *                      | WITH (options)
!  *                      | WHERE expression }

Note that I removed the USING keyword in the stat types list, and also
made it mandatory that that list appears immediately after the new stats
name.  This should make it possible to have USING in the relation list
(the FROM clause), if we allow explicit multiple relations with join
syntax there.  The other options can appear in any order.

Also, both WITH and WHERE are accepted by the grammar, but immediately
throw "feature not implemented" error at parse time.

I was on the fence about adding copy/equal/out support for the new
StatisticArgument node; it seems pointless because that node does not
leave gram.y anyway.

Unless there are objections, I'll push this tomorrow.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Nikita Glukhov
Date:
Subject: [HACKERS] Fix freeing of dangling IndexScanDesc.xs_hitup in GiST
Next
From: Jordan Deitch
Date:
Subject: Re: [HACKERS] json_agg produces nonstandard json