Thread:
Hi, hackers
I find that ALTER TABLE xxx FORCE/NO FORCE ROW LEVEL SECURITY cannot support tab complete.
The attached add the tab complete for rls.
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 561fe1dff9..b2b4f1fd4d 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1974,10 +1974,10 @@ psql_completion(const char *text, int start, int end)
*/
else if (Matches("ALTER", "TABLE", MatchAny))
COMPLETE_WITH("ADD", "ALTER", "CLUSTER ON", "DISABLE", "DROP",
- "ENABLE", "INHERIT", "NO INHERIT", "RENAME", "RESET",
+ "ENABLE", "INHERIT", "NO", "RENAME", "RESET",
"OWNER TO", "SET", "VALIDATE CONSTRAINT",
"REPLICA IDENTITY", "ATTACH PARTITION",
- "DETACH PARTITION");
+ "DETACH PARTITION", "FORCE ROW LEVEL SECURITY");
/* ALTER TABLE xxx ENABLE */
else if (Matches("ALTER", "TABLE", MatchAny, "ENABLE"))
COMPLETE_WITH("ALWAYS", "REPLICA", "ROW LEVEL SECURITY", "RULE",
@@ -2007,6 +2007,9 @@ psql_completion(const char *text, int start, int end)
/* ALTER TABLE xxx INHERIT */
else if (Matches("ALTER", "TABLE", MatchAny, "INHERIT"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, "");
+ /* ALTER TABLE xxx NO */
+ else if (Matches("ALTER", "TABLE", MatchAny, "NO"))
+ COMPLETE_WITH("FORCE ROW LEVEL SECURITY", "INHERIT");
/* ALTER TABLE xxx NO INHERIT */
else if (Matches("ALTER", "TABLE", MatchAny, "NO", "INHERIT"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, "”);
Best regards.
--
ChengDu WenWu Information Technology Co,Ltd.
Japin Li
Attachment
Sorry, I forgot add the subject.
--
Best regards
Japin Li
On Oct 23, 2020, at 1:19 PM, Li Japin <japinli@hotmail.com> wrote:<0001-Add-tab-complete-for-alter-table-rls.patch>Hi, hackersI find that ALTER TABLE xxx FORCE/NO FORCE ROW LEVEL SECURITY cannot support tab complete.The attached add the tab complete for rls.diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.cindex 561fe1dff9..b2b4f1fd4d 100644--- a/src/bin/psql/tab-complete.c+++ b/src/bin/psql/tab-complete.c@@ -1974,10 +1974,10 @@ psql_completion(const char *text, int start, int end)*/else if (Matches("ALTER", "TABLE", MatchAny))COMPLETE_WITH("ADD", "ALTER", "CLUSTER ON", "DISABLE", "DROP",- "ENABLE", "INHERIT", "NO INHERIT", "RENAME", "RESET",+ "ENABLE", "INHERIT", "NO", "RENAME", "RESET","OWNER TO", "SET", "VALIDATE CONSTRAINT","REPLICA IDENTITY", "ATTACH PARTITION",- "DETACH PARTITION");+ "DETACH PARTITION", "FORCE ROW LEVEL SECURITY");/* ALTER TABLE xxx ENABLE */else if (Matches("ALTER", "TABLE", MatchAny, "ENABLE"))COMPLETE_WITH("ALWAYS", "REPLICA", "ROW LEVEL SECURITY", "RULE",@@ -2007,6 +2007,9 @@ psql_completion(const char *text, int start, int end)/* ALTER TABLE xxx INHERIT */else if (Matches("ALTER", "TABLE", MatchAny, "INHERIT"))COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, "");+ /* ALTER TABLE xxx NO */+ else if (Matches("ALTER", "TABLE", MatchAny, "NO"))+ COMPLETE_WITH("FORCE ROW LEVEL SECURITY", "INHERIT");/* ALTER TABLE xxx NO INHERIT */else if (Matches("ALTER", "TABLE", MatchAny, "NO", "INHERIT"))COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, "”);Best regards.--ChengDu WenWu Information Technology Co,Ltd.Japin Li
On Fri, Oct 23, 2020 at 05:22:57AM +0000, Li Japin wrote: > Sorry, I forgot add the subject. No worries. Good catch. I'll try to test that and apply it later, but by reading the code it looks like you got that right. -- Michael
Attachment
On Fri, Oct 23, 2020 at 04:37:18PM +0900, Michael Paquier wrote: > No worries. Good catch. I'll try to test that and apply it later, > but by reading the code it looks like you got that right. Checked and applied on HEAD, thanks! -- Michael
Attachment
Thanks Michael! -- Best regards Japin Li > On Oct 24, 2020, at 9:49 AM, Michael Paquier <michael@paquier.xyz> wrote: > > On Fri, Oct 23, 2020 at 04:37:18PM +0900, Michael Paquier wrote: >> No worries. Good catch. I'll try to test that and apply it later, >> but by reading the code it looks like you got that right. > > Checked and applied on HEAD, thanks! > -- > Michael