Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d8e6ae9

Browse files
committed
Fix tab-completion after commit 790bf61
I (Álvaro) broke tab-completion for GRANT .. ALL TABLES IN SCHEMA while removing ALL from the publication syntax for schemas in the aforementioned commit. I also missed to update a bunch of tab-completion rules for ALTER/CREATE PUBLICATION that match each individual piece of ALL TABLES IN SCHEMA. Repair those bugs. While fixing up that commit, update a couple of outdated comments related to the same change. Backpatch to 15. Author: Shi yu <shiy.fnst@fujitsu.com> Reviewed-by: Peter Smith <smithpb2250@gmail.com> Discussion: https://postgr.es/m/OSZPR01MB6310FCE8609185A56344EED2FD559@OSZPR01MB6310.jpnprd01.prod.outlook.com
1 parent a613474 commit d8e6ae9

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/backend/replication/logical/tablesync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ fetch_remote_table_info(char *nspname, char *relname,
937937
*
938938
* 2) one of the subscribed publications has puballtables set to true
939939
*
940-
* 3) one of the subscribed publications is declared as ALL TABLES IN
941-
* SCHEMA that includes this relation
940+
* 3) one of the subscribed publications is declared as TABLES IN SCHEMA
941+
* that includes this relation
942942
*/
943943
if (walrcv_server_version(LogRepWorkerWalRcvConn) >= 150000)
944944
{

src/bin/psql/tab-complete.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ psql_completion(const char *text, int start, int end)
18481848
/* ALTER PUBLICATION <name> SET */
18491849
else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET"))
18501850
COMPLETE_WITH("(", "TABLES IN SCHEMA", "TABLE");
1851-
else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP|SET", "ALL", "TABLES", "IN", "SCHEMA"))
1851+
else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP|SET", "TABLES", "IN", "SCHEMA"))
18521852
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas
18531853
" AND nspname NOT LIKE E'pg\\\\_%%'",
18541854
"CURRENT_SCHEMA");
@@ -2979,9 +2979,11 @@ psql_completion(const char *text, int start, int end)
29792979
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR"))
29802980
COMPLETE_WITH("TABLE", "ALL TABLES", "TABLES IN SCHEMA");
29812981
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL"))
2982-
COMPLETE_WITH("TABLES", "TABLES IN SCHEMA");
2982+
COMPLETE_WITH("TABLES");
29832983
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES"))
2984-
COMPLETE_WITH("IN SCHEMA", "WITH (");
2984+
COMPLETE_WITH("WITH (");
2985+
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLES"))
2986+
COMPLETE_WITH("IN SCHEMA");
29852987
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLE", MatchAny) && !ends_with(prev_wd, ','))
29862988
COMPLETE_WITH("WHERE (", "WITH (");
29872989
/* Complete "CREATE PUBLICATION <name> FOR TABLE" with "<table>, ..." */
@@ -3002,11 +3004,11 @@ psql_completion(const char *text, int start, int end)
30023004
/*
30033005
* Complete "CREATE PUBLICATION <name> FOR TABLES IN SCHEMA <schema>, ..."
30043006
*/
3005-
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA"))
3007+
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLES", "IN", "SCHEMA"))
30063008
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas
30073009
" AND nspname NOT LIKE E'pg\\\\_%%'",
30083010
"CURRENT_SCHEMA");
3009-
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA", MatchAny) && (!ends_with(prev_wd, ',')))
3011+
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLES", "IN", "SCHEMA", MatchAny) && (!ends_with(prev_wd, ',')))
30103012
COMPLETE_WITH("WITH (");
30113013
/* Complete "CREATE PUBLICATION <name> [...] WITH" */
30123014
else if (HeadMatches("CREATE", "PUBLICATION") && TailMatches("WITH", "("))
@@ -3820,7 +3822,7 @@ psql_completion(const char *text, int start, int end)
38203822
"ALL PROCEDURES IN SCHEMA",
38213823
"ALL ROUTINES IN SCHEMA",
38223824
"ALL SEQUENCES IN SCHEMA",
3823-
"TABLES IN SCHEMA",
3825+
"ALL TABLES IN SCHEMA",
38243826
"DATABASE",
38253827
"DOMAIN",
38263828
"FOREIGN DATA WRAPPER",

src/test/subscription/t/031_column_list.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,8 @@
899899
'all columns should be replicated');
900900

901901

902-
# TEST: With a table included in the publication which is FOR ALL TABLES
903-
# IN SCHEMA, it means replicate all columns.
902+
# TEST: With a table included in the publication which is FOR TABLES IN
903+
# SCHEMA, it means replicate all columns.
904904

905905
$node_subscriber->safe_psql(
906906
'postgres', qq(

0 commit comments

Comments
 (0)