[PATCH] psql: Complete GRANTED BY in GRANT and REVOKE

From: Neil Chen <carpenter(dot)nail(dot)cz(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] psql: Complete GRANTED BY in GRANT and REVOKE
Date: 2026-11-20 08:57:52
Message-ID: CAA3qoJ=eA85GW5Enrc5h5tTEowxfUo-A3vaL-ebSY-5Zxqm=TQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

While trying REVOKE ... GRANTED BY in PostgreSQL 19, I noticed that
psql doesn't complete the clause or the grantor's name.

I tried the corresponding GRANT and found that pressing Tab after
a trailing space on this line inserts TO, making the statement invalid.

GRANT SELECT ON t TO r WITH GRANT OPTION

Before the patch, the generic GRANT rule treats the trailing GRANT
OPTION as GRANT followed by a role name. The patch matches WITH
GRANT OPTION first, so Tab inserts GRANTED BY. It also completes
the clause and grantor name in both commands.

Thanks,

--
Ze Chen (Neil)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
0001-psql-Complete-GRANTED-BY-in-GRANT-and-REVOKE.patch text/x-patch 4.5 KB

Browse pgsql-hackers by date

  From Date Subject
Previous Message Alex Masterov 2026-11-20 08:25:49 Re: Snapshot related assert failure on skink