0001-Removed-unused-parameter-from-ObjectsInPublicationTo.patch
text/x-patch
Filename: 0001-Removed-unused-parameter-from-ObjectsInPublicationTo.patch
Type: text/x-patch
Part: 0
Patch
Format: format-patch
Series: patch 0001
Subject: Removed unused parameter from ObjectsInPublicationToOids.
| File | + | − |
|---|---|---|
| src/backend/commands/publicationcmds.c | 3 | 12 |
| src/bin/psql/tab-complete.c | 1 | 4 |
From dc707ba93494e3ba0cffd8ab6e1fb1b7a1c0e70e Mon Sep 17 00:00:00 2001
From: Vigneshwaran C <vignesh21@gmail.com>
Date: Fri, 25 Mar 2022 19:49:40 +0530
Subject: [PATCH] Removed unused parameter from ObjectsInPublicationToOids.
Removed unused parameter from ObjectsInPublicationToOids.
---
src/backend/commands/publicationcmds.c | 15 +++------------
src/bin/psql/tab-complete.c | 5 +----
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index c6437799c5..89298d7857 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -175,8 +175,7 @@ parse_publication_options(ParseState *pstate,
static void
ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
List **tables, List **sequences,
- List **tables_schemas, List **sequences_schemas,
- List **schemas)
+ List **tables_schemas, List **sequences_schemas)
{
ListCell *cell;
PublicationObjSpec *pubobj;
@@ -204,14 +203,12 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
/* Filter out duplicates if user specifies "sch1, sch1" */
*tables_schemas = list_append_unique_oid(*tables_schemas, schemaid);
- *schemas = list_append_unique_oid(*schemas, schemaid);
break;
case PUBLICATIONOBJ_SEQUENCES_IN_SCHEMA:
schemaid = get_namespace_oid(pubobj->name, false);
/* Filter out duplicates if user specifies "sch1, sch1" */
*sequences_schemas = list_append_unique_oid(*sequences_schemas, schemaid);
- *schemas = list_append_unique_oid(*schemas, schemaid);
break;
case PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA:
search_path = fetch_search_path(false);
@@ -225,7 +222,6 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
/* Filter out duplicates if user specifies "sch1, sch1" */
*tables_schemas = list_append_unique_oid(*tables_schemas, schemaid);
- *schemas = list_append_unique_oid(*schemas, schemaid);
break;
case PUBLICATIONOBJ_SEQUENCES_IN_CUR_SCHEMA:
search_path = fetch_search_path(false);
@@ -239,7 +235,6 @@ ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
/* Filter out duplicates if user specifies "sch1, sch1" */
*sequences_schemas = list_append_unique_oid(*sequences_schemas, schemaid);
- *schemas = list_append_unique_oid(*schemas, schemaid);
break;
default:
/* shouldn't happen */
@@ -679,7 +674,6 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
List *sequences = NIL;
List *tables_schemaidlist = NIL;
List *sequences_schemaidlist = NIL;
- List *schemaidlist = NIL;
bool for_all_tables = false;
bool for_all_sequences = false;
@@ -782,8 +776,7 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
ObjectsInPublicationToOids(stmt->pubobjects, pstate,
&tables, &sequences,
&tables_schemaidlist,
- &sequences_schemaidlist,
- &schemaidlist);
+ &sequences_schemaidlist);
/* FOR ALL TABLES IN SCHEMA requires superuser */
if (list_length(tables_schemaidlist) > 0 && !superuser())
@@ -1462,14 +1455,12 @@ AlterPublication(ParseState *pstate, AlterPublicationStmt *stmt)
List *sequences = NIL;
List *tables_schemaidlist = NIL;
List *sequences_schemaidlist = NIL;
- List *schemaidlist = NIL;
Oid pubid = pubform->oid;
ObjectsInPublicationToOids(stmt->pubobjects, pstate,
&tables, &sequences,
&tables_schemaidlist,
- &sequences_schemaidlist,
- &schemaidlist);
+ &sequences_schemaidlist);
CheckAlterPublication(stmt, tup,
tables, tables_schemaidlist,
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 63bfdf11c6..682d4fe18d 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1814,7 +1814,7 @@ psql_completion(const char *text, int start, int end)
else if (Matches("ALTER", "PUBLICATION", MatchAny))
COMPLETE_WITH("ADD", "DROP", "OWNER TO", "RENAME TO", "SET");
/* ALTER PUBLICATION <name> ADD */
- else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD"))
+ else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP"))
COMPLETE_WITH("ALL TABLES IN SCHEMA", "ALL SEQUENCES IN SCHEMA", "TABLE", "SEQUENCE");
else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") ||
(HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") &&
@@ -1840,9 +1840,6 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH(",", "WHERE (");
else if (HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE"))
COMPLETE_WITH(",");
- /* ALTER PUBLICATION <name> DROP */
- else if (Matches("ALTER", "PUBLICATION", MatchAny, "DROP"))
- COMPLETE_WITH("ALL TABLES IN SCHEMA", "ALL SEQUENCES IN SCHEMA", "TABLE", "SEQUENCE");
/* ALTER PUBLICATION <name> SET */
else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET"))
COMPLETE_WITH("(", "ALL TABLES IN SCHEMA", "ALL SEQUENCES IN SCHEMA", "TABLE", "SEQUENCE");
--
2.32.0