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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user