mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Refactor CLUSTER and REINDEX grammar to use DefElem for option lists
This changes CLUSTER and REINDEX so as a parenthesized grammar becomes
possible for options, while unifying the grammar parsing rules for
option lists with the existing ones.
This is a follow-up of the work done in 873ea9e
for VACUUM, ANALYZE and
EXPLAIN. This benefits REINDEX for a potential backend-side filtering
for collatable-sensitive indexes and TABLESPACE, while CLUSTER would
benefit from the latter.
Author: Alexey Kondratov, Justin Pryzby
Discussion: https://postgr.es/m/8a8f5f73-00d3-55f8-7583-1375ca8f6a91@postgrespro.ru
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "access/xact.h"
|
||||
#include "access/xlog.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_inherits.h"
|
||||
#include "catalog/toasting.h"
|
||||
@@ -818,7 +819,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
|
||||
break;
|
||||
|
||||
case T_ClusterStmt:
|
||||
cluster((ClusterStmt *) parsetree, isTopLevel);
|
||||
cluster(pstate, (ClusterStmt *) parsetree, isTopLevel);
|
||||
break;
|
||||
|
||||
case T_VacuumStmt:
|
||||
@@ -918,20 +919,20 @@ standard_ProcessUtility(PlannedStmt *pstmt,
|
||||
case T_ReindexStmt:
|
||||
{
|
||||
ReindexStmt *stmt = (ReindexStmt *) parsetree;
|
||||
int options;
|
||||
|
||||
if ((stmt->options & REINDEXOPT_CONCURRENTLY) != 0)
|
||||
options = ReindexParseOptions(pstate, stmt);
|
||||
if ((options & REINDEXOPT_CONCURRENTLY) != 0)
|
||||
PreventInTransactionBlock(isTopLevel,
|
||||
"REINDEX CONCURRENTLY");
|
||||
|
||||
switch (stmt->kind)
|
||||
{
|
||||
case REINDEX_OBJECT_INDEX:
|
||||
ReindexIndex(stmt->relation, stmt->options,
|
||||
isTopLevel);
|
||||
ReindexIndex(stmt->relation, options, isTopLevel);
|
||||
break;
|
||||
case REINDEX_OBJECT_TABLE:
|
||||
ReindexTable(stmt->relation, stmt->options,
|
||||
isTopLevel);
|
||||
ReindexTable(stmt->relation, options, isTopLevel);
|
||||
break;
|
||||
case REINDEX_OBJECT_SCHEMA:
|
||||
case REINDEX_OBJECT_SYSTEM:
|
||||
@@ -947,7 +948,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
|
||||
(stmt->kind == REINDEX_OBJECT_SCHEMA) ? "REINDEX SCHEMA" :
|
||||
(stmt->kind == REINDEX_OBJECT_SYSTEM) ? "REINDEX SYSTEM" :
|
||||
"REINDEX DATABASE");
|
||||
ReindexMultipleTables(stmt->name, stmt->kind, stmt->options);
|
||||
ReindexMultipleTables(stmt->name, stmt->kind, options);
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized object type: %d",
|
||||
|
Reference in New Issue
Block a user