aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2017-09-06 13:46:01 -0700
committerSimon Riggs <simon@2ndQuadrant.com>2017-09-06 13:46:01 -0700
commit5b6d13eec72b960eb0f78542199380e49c8583d4 (patch)
tree8893caeb77015bb2502f3795954b6f59b5b04305 /src/backend/parser
parente09db94c0a5f3b440d96c5c9e8e6c1638d1ec39f (diff)
downloadpostgresql-5b6d13eec72b960eb0f78542199380e49c8583d4.tar.gz
postgresql-5b6d13eec72b960eb0f78542199380e49c8583d4.zip
Allow SET STATISTICS on expression indexes
Index columns are referenced by ordinal number rather than name, e.g. CREATE INDEX coord_idx ON measured (x, y, (z + t)); ALTER INDEX coord_idx ALTER COLUMN 3 SET STATISTICS 1000; Incompatibility note for release notes: \d+ for indexes now also displays Stats Target Authors: Alexander Korotkov, with contribution by Adrien NAYRAT Review: Adrien NAYRAT, Simon Riggs Wordsmith: Simon Riggs
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 7d0de99baf2..5eb398118e5 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -2078,6 +2078,22 @@ alter_table_cmd:
n->def = (Node *) makeInteger($6);
$$ = (Node *)n;
}
+ /* ALTER TABLE <name> ALTER [COLUMN] <colnum> SET STATISTICS <SignedIconst> */
+ | ALTER opt_column Iconst SET STATISTICS SignedIconst
+ {
+ AlterTableCmd *n = makeNode(AlterTableCmd);
+
+ if ($3 <= 0 || $3 > PG_INT16_MAX)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("column number must be in range from 1 to %d", PG_INT16_MAX),
+ parser_errposition(@3)));
+
+ n->subtype = AT_SetStatistics;
+ n->num = (int16) $3;
+ n->def = (Node *) makeInteger($6);
+ $$ = (Node *)n;
+ }
/* ALTER TABLE <name> ALTER [COLUMN] <colname> SET ( column_parameter = value [, ... ] ) */
| ALTER opt_column ColId SET reloptions
{