commit 1119bfda3f8f03bdc9d8f01e4dd32888cb7b9556 Author: Alvaro Herrera AuthorDate: Wed May 3 12:05:11 2017 -0300 CommitDate: Wed May 3 12:08:55 2017 -0300 remove unused WITH diff --git b/src/backend/commands/statscmds.c a/src/backend/commands/statscmds.c index f4d1712091..5cd2d809ae 100644 --- b/src/backend/commands/statscmds.c +++ a/src/backend/commands/statscmds.c @@ -193,6 +193,13 @@ CreateStatistics(CreateStatsStmt *stmt) /* Form an int2vector representation of the sorted column list */ stxkeys = buildint2vector(attnums, numcols); + foreach (l, stmt->options) + { + DefElem *opt = (DefElem *) lfirst(l); + + elog(ERROR, "option \"%s\" not supported", opt->defname); + } + /* * Parse the statistic type options. */ diff --git b/src/backend/nodes/copyfuncs.c a/src/backend/nodes/copyfuncs.c index 01c57e4783..62540aadf1 100644 --- b/src/backend/nodes/copyfuncs.c +++ a/src/backend/nodes/copyfuncs.c @@ -3391,6 +3391,7 @@ _copyCreateStatsStmt(const CreateStatsStmt *from) COPY_NODE_FIELD(defnames); COPY_NODE_FIELD(relation); COPY_NODE_FIELD(keys); + COPY_NODE_FIELD(options); COPY_NODE_FIELD(stat_options); COPY_SCALAR_FIELD(if_not_exists); diff --git b/src/backend/nodes/equalfuncs.c a/src/backend/nodes/equalfuncs.c index 01e2124883..66d07110d5 100644 --- b/src/backend/nodes/equalfuncs.c +++ a/src/backend/nodes/equalfuncs.c @@ -1351,6 +1351,7 @@ _equalCreateStatsStmt(const CreateStatsStmt *a, const CreateStatsStmt *b) COMPARE_NODE_FIELD(defnames); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(keys); + COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(stat_options); COMPARE_SCALAR_FIELD(if_not_exists); diff --git b/src/backend/nodes/outfuncs.c a/src/backend/nodes/outfuncs.c index 015537a4c8..f589976823 100644 --- b/src/backend/nodes/outfuncs.c +++ a/src/backend/nodes/outfuncs.c @@ -2641,6 +2641,7 @@ _outCreateStatsStmt(StringInfo str, const CreateStatsStmt *node) WRITE_NODE_FIELD(defnames); WRITE_NODE_FIELD(relation); WRITE_NODE_FIELD(keys); + WRITE_NODE_FIELD(options); WRITE_NODE_FIELD(stat_options); WRITE_BOOL_FIELD(if_not_exists); } diff --git b/src/backend/parser/gram.y a/src/backend/parser/gram.y index a3467f1c47..be7d35c816 100644 --- b/src/backend/parser/gram.y +++ a/src/backend/parser/gram.y @@ -3831,7 +3831,10 @@ ExistingIndex: USING INDEX index_name { $$ = $3; } * * QUERY : * CREATE STATISTICS stats_name [USING (stat_options)] - * ON (columns) FROM relname + * [WITH (options)] ON (columns) FROM relname + * + * Note that currently there are no "options" implemented, so the WITH clause + * must always be omitted. * *****************************************************************************/ @@ -3861,24 +3864,26 @@ stat_option_elem: CreateStatsStmt: CREATE STATISTICS any_name opt_stat_option_list - ON '(' columnList ')' FROM qualified_name + opt_reloptions ON '(' columnList ')' FROM qualified_name { CreateStatsStmt *n = makeNode(CreateStatsStmt); n->defnames = $3; - n->relation = $10; - n->keys = $7; + n->relation = $11; + n->keys = $8; n->stat_options = $4; + n->options = $5; n->if_not_exists = false; $$ = (Node *)n; } | CREATE STATISTICS IF_P NOT EXISTS any_name opt_stat_option_list - ON '(' columnList ')' FROM qualified_name + opt_reloptions ON '(' columnList ')' FROM qualified_name { CreateStatsStmt *n = makeNode(CreateStatsStmt); n->defnames = $6; - n->relation = $13; - n->keys = $10; + n->relation = $14; + n->keys = $11; n->stat_options = $7; + n->options = $8; n->if_not_exists = true; $$ = (Node *)n; } diff --git b/src/include/nodes/parsenodes.h a/src/include/nodes/parsenodes.h index 0409f9d814..ab69c593cc 100644 --- b/src/include/nodes/parsenodes.h +++ a/src/include/nodes/parsenodes.h @@ -2692,6 +2692,7 @@ typedef struct CreateStatsStmt RangeVar *relation; /* relation to build statistics on */ List *keys; /* String nodes naming referenced columns */ List *stat_options; /* list of name-only DefElem for stat types */ + List *options; /* list of DefElem for general options */ bool if_not_exists; /* do nothing if statistics already exists */ } CreateStatsStmt;