mirror of https://github.com/citusdata/citus.git
Apply suggestions from code review
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>pull/7240/head
parent
7a6afb0beb
commit
3067d1ef08
|
@ -275,7 +275,7 @@ PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString,
|
|||
* postgres instance.
|
||||
*
|
||||
* In this stage, we can perform validations and prepare the commands that need to
|
||||
* be run on all workers to grant.
|
||||
* be run on all workers to create the database.
|
||||
*/
|
||||
List *
|
||||
PreprocessCreateDatabaseStmt(Node *node, const char *queryString,
|
||||
|
@ -298,7 +298,9 @@ PreprocessCreateDatabaseStmt(Node *node, const char *queryString,
|
|||
/*
|
||||
* PostprocessCreatedbStmt is executed after the statement is applied to the local
|
||||
* postgres instance. In this stage we can prepare the commands that need to be run on
|
||||
* all workers to create the database.
|
||||
* all workers to create the database. Since the CREATE DATABASE statement gives error
|
||||
* in a transaction block, we need to use NontransactionalNodeDDLTaskList to send the
|
||||
* CREATE DATABASE statement to the workers.
|
||||
*
|
||||
*/
|
||||
List *
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
/*
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* citus_deparseutils.c
|
||||
* ---------------------
|
||||
*
|
||||
* This file contains common functions used for deparsing PostgreSQL statements
|
||||
* to their equivalent SQL representation.
|
||||
* This file contains common functions used for deparsing PostgreSQL
|
||||
* statements to their equivalent SQL representation.
|
||||
*
|
||||
* Copyright (c) Citus Data, Inc.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "pg_version_constants.h"
|
||||
|
||||
#include "postgres.h"
|
||||
|
@ -31,9 +35,9 @@
|
|||
* @param optionFormatsLen The number of option formats in the opt_formats array.
|
||||
*/
|
||||
void
|
||||
DefElemOptionToStatement(StringInfo buf, DefElem *option, const
|
||||
DefElemOptionFormat *optionFormats, int
|
||||
optionFormatsLen)
|
||||
DefElemOptionToStatement(StringInfo buf, DefElem *option,
|
||||
const DefElemOptionFormat *optionFormats,
|
||||
int optionFormatsLen)
|
||||
{
|
||||
const char *name = option->defname;
|
||||
int i;
|
||||
|
|
|
@ -360,8 +360,10 @@ ExecuteCommandAsSuperuser(char *query, int paramCount, Oid *paramTypes,
|
|||
|
||||
|
||||
/*
|
||||
* Deletes all pg_dist_object records for distributed roles in `DROP ROLE` statement a
|
||||
* and for all databases in `DROP DATABASE` statement
|
||||
* UnmarkNodeWideObjectsDistributed deletes pg_dist_object records
|
||||
* for all distributed objects in given Drop stmt node.
|
||||
*
|
||||
* Today we only expect DropRoleStmt and DropdbStmt to get here.
|
||||
*/
|
||||
void
|
||||
UnmarkNodeWideObjectsDistributed(Node *node)
|
||||
|
|
|
@ -3902,11 +3902,13 @@ Datum
|
|||
citus_internal_database_command(PG_FUNCTION_ARGS)
|
||||
{
|
||||
CheckCitusVersion(ERROR);
|
||||
|
||||
if (!ShouldSkipMetadataChecks())
|
||||
{
|
||||
EnsureCitusInitiatedOperation();
|
||||
}
|
||||
PG_ENSURE_ARGNOTNULL(0, "database command");
|
||||
|
||||
PG_ENSURE_ARGNOTNULL(0, "command");
|
||||
|
||||
text *commandText = PG_GETARG_TEXT_P(0);
|
||||
char *command = text_to_cstring(commandText);
|
||||
|
@ -3960,7 +3962,7 @@ citus_internal_database_command(PG_FUNCTION_ARGS)
|
|||
ereport(ERROR, (errmsg("unsupported command type %d", nodeTag(parseTree))));
|
||||
}
|
||||
|
||||
/* Rollbacks GUCs to the state before this session */
|
||||
/* rollback GUCs to the state before this session */
|
||||
AtEOXact_GUC(true, saveNestLevel);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
|
|
|
@ -140,9 +140,9 @@ typedef enum OptionFormatType
|
|||
} OptionFormatType;
|
||||
|
||||
|
||||
extern void DefElemOptionToStatement(StringInfo buf, DefElem *option, const
|
||||
DefElemOptionFormat *opt_formats, int
|
||||
opt_formats_len);
|
||||
extern void DefElemOptionToStatement(StringInfo buf, DefElem *option,
|
||||
const DefElemOptionFormat *opt_formats,
|
||||
int opt_formats_len);
|
||||
|
||||
|
||||
/* forward declarations for deparse_statistics_stmts.c */
|
||||
|
|
Loading…
Reference in New Issue