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

Commit 69298db

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 51fd7cd commit 69298db

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
@@ -978,8 +978,8 @@ fetch_remote_table_info(char *nspname, char *relname,
978978
*
979979
* 2) one of the subscribed publications has puballtables set to true
980980
*
981-
* 3) one of the subscribed publications is declared as ALL TABLES IN
982-
* SCHEMA that includes this relation
981+
* 3) one of the subscribed publications is declared as TABLES IN SCHEMA
982+
* that includes this relation
983983
*/
984984
if (walrcv_server_version(LogRepWorkerWalRcvConn) >= 150000)
985985
{

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");
@@ -2994,9 +2994,11 @@ psql_completion(const char *text, int start, int end)
29942994
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR"))
29952995
COMPLETE_WITH("TABLE", "ALL TABLES", "TABLES IN SCHEMA");
29962996
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL"))
2997-
COMPLETE_WITH("TABLES", "TABLES IN SCHEMA");
2997+
COMPLETE_WITH("TABLES");
29982998
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES"))
2999-
COMPLETE_WITH("IN SCHEMA", "WITH (");
2999+
COMPLETE_WITH("WITH (");
3000+
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLES"))
3001+
COMPLETE_WITH("IN SCHEMA");
30003002
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLE", MatchAny) && !ends_with(prev_wd, ','))
30013003
COMPLETE_WITH("WHERE (", "WITH (");
30023004
/* Complete "CREATE PUBLICATION <name> FOR TABLE" with "<table>, ..." */
@@ -3017,11 +3019,11 @@ psql_completion(const char *text, int start, int end)
30173019
/*
30183020
* Complete "CREATE PUBLICATION <name> FOR TABLES IN SCHEMA <schema>, ..."
30193021
*/
3020-
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA"))
3022+
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLES", "IN", "SCHEMA"))
30213023
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas
30223024
" AND nspname NOT LIKE E'pg\\\\_%%'",
30233025
"CURRENT_SCHEMA");
3024-
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA", MatchAny) && (!ends_with(prev_wd, ',')))
3026+
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLES", "IN", "SCHEMA", MatchAny) && (!ends_with(prev_wd, ',')))
30253027
COMPLETE_WITH("WITH (");
30263028
/* Complete "CREATE PUBLICATION <name> [...] WITH" */
30273029
else if (HeadMatches("CREATE", "PUBLICATION") && TailMatches("WITH", "("))
@@ -3835,7 +3837,7 @@ psql_completion(const char *text, int start, int end)
38353837
"ALL PROCEDURES IN SCHEMA",
38363838
"ALL ROUTINES IN SCHEMA",
38373839
"ALL SEQUENCES IN SCHEMA",
3838-
"TABLES IN SCHEMA",
3840+
"ALL TABLES IN SCHEMA",
38393841
"DATABASE",
38403842
"DOMAIN",
38413843
"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)