1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-28 11:55:03 +03:00

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
This commit is contained in:
Simon Riggs
2017-09-06 13:46:01 -07:00
parent e09db94c0a
commit 5b6d13eec7
13 changed files with 201 additions and 17 deletions

View File

@@ -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
{