From 69217678b3ebd3e231531e752208078c877b6064 Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Mon, 13 Nov 2023 12:16:08 +0300 Subject: [PATCH] allow wal_log option only if it's set to default --- .../distributed/deparser/deparse_database_stmts.c | 13 ++++++++++--- src/include/distributed/commands.h | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/backend/distributed/deparser/deparse_database_stmts.c b/src/backend/distributed/deparser/deparse_database_stmts.c index 3383d2954..2c1dc0b66 100644 --- a/src/backend/distributed/deparser/deparse_database_stmts.c +++ b/src/backend/distributed/deparser/deparse_database_stmts.c @@ -259,7 +259,7 @@ DeparseAlterDatabaseSetStmt(Node *node) static void ValidateCreateDatabaseOptions(DefElem *option) { - if (strcmp(option->defname, "strategy") == 0 || strcmp(option->defname, "oid") == 0) + if (strcmp(option->defname, "oid") == 0) { ereport(ERROR, errmsg("CREATE DATABASE option \"%s\" is not supported", @@ -267,11 +267,18 @@ ValidateCreateDatabaseOptions(DefElem *option) } char *optionValue = defGetString(option); + if (strcmp(option->defname, "template") == 0 && strcmp(optionValue, "template1") != 0) { - ereport(ERROR, errmsg( - "Only template1 is supported as template parameter for CREATE DATABASE")); + ereport(ERROR, errmsg("Only template1 is supported as template " + "parameter for CREATE DATABASE")); } + + if (strcmp(option->defname, "strategy") == 0 && strcmp(optionValue, "wal_log") != 0) + { + ereport(ERROR, errmsg("Only wal_log is supported as strategy " + "parameter for CREATE DATABASE")); + } } diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index 85c55d39a..4c47d3ecd 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -239,9 +239,9 @@ extern List * PreprocessCreateDatabaseStmt(Node *node, const char *queryString, extern List * PostprocessCreateDatabaseStmt(Node *node, const char *queryString); extern List * PreprocessDropDatabaseStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * DropDatabaseStmtObjectAddress(Node *node, bool missing_ok, +extern List * DropDatabaseStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess); -extern List * CreateDatabaseStmtObjectAddress(Node *node, bool missing_ok, +extern List * CreateDatabaseStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess); extern List * GenerateCreateDatabaseCommandList(void);