Re: Improve tab completion for ALTER DEFAULT PRIVILEGE and ALTER TABLE

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Improve tab completion for ALTER DEFAULT PRIVILEGE and ALTER TABLE
Date: 2023-11-24 13:07:37
Message-ID: CAHv8RjKD5gtpao+m=iUnHbo1YATisJXUyZoG5f0XCYgyiSKekg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

n Fri, Nov 24, 2023 at 6:33 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> Hi,
>
> Improved tab completion for "ALTER DEFAULT PRIVILEGE" and "ALTER TABLE":
> 1) GRANT, REVOKE and FOR USER keyword was not displayed in tab
> completion of alter default privileges like the below statement:
> ALTER DEFAULT PRIVILEGES GRANT INSERT ON tables TO PUBLIC;
> ALTER DEFAULT PRIVILEGES REVOKE INSERT ON tables FROM PUBLIC;
> ALTER DEFAULT PRIVILEGES FOR USER vignesh revoke INSERT ON tables FROM dba1;
>
> 2) USER was not displayed for "ALTER DEFAULT PRIVILEGES IN SCHEMA
> public FOR " like in below statement:
> ALTER DEFAULT PRIVILEGES IN SCHEMA public FOR USER dba1 GRANT INSERT
> ON TABLES TO PUBLIC;
>
> 3) "FOR GRANT OPTION" was not display for "ALTER DEFAULT PRIVILEGES
> REVOKE " like in below statement:
> alter default privileges revoke grant option for select ON tables FROM dba1;
>
> 4) "DATA TYPE" was missing in "ALTER TABLE table-name ALTER COLUMN
> column-name SET" like in:
> ALTER TABLE t1 ALTER COLUMN c1 SET DATA TYPE text;
>
> Attached patch has the changes for the same.

+    COMPLETE_WITH("ROLE", "USER");
+  /* ALTER DEFAULT PRIVILEGES REVOKE */
+  else if (Matches("ALTER", "DEFAULT", "PRIVILEGES", "REVOKE"))
+    COMPLETE_WITH("SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE",
+           "REFERENCES", "TRIGGER", "CREATE", "EXECUTE", "USAGE",
+           "MAINTAIN", "ALL", "GRANT OPTION FOR");

I could not find "alter default privileges revoke maintain", should
this be removed?

Regards,
Shubham Khanna

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Benesch 2023-11-24 13:53:07 Re: pgoutput incorrectly replaces missing values with NULL since PostgreSQL 15
Previous Message Aleksander Alekseev 2023-11-24 12:51:59 Re: How to accurately determine when a relation should use local buffers?