[PATCH] psql: avoid CREATE command completion after GRANT/REVOKE CREATE
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
This thread has been committed, so CI has stopped here. Anything below is the last result it produced.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t254017psql -h localhost -U postgresBuilt from patchset v6 (message #6), October 07, 2026 at 08:30 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t254017_6 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t254017_6 && git checkout t254017_6Patchset v6 (message #6) is on t254017_6
Hi,
While testing psql tab completion, I noticed that the generic CREATE
completion rule is triggered after GRANT CREATE and REVOKE CREATE.
This results in irrelevant CREATE object type suggestions being offered
in those contexts.
I created a patch to exclude GRANT CREATE and REVOKE CREATE from the
generic CREATE completion rule.
Regards,
Haruna Miwa
--
Haruna Miwa
Hi Haruna,
I tested the patch and confirmed that `GRANT CREATE` and `REVOKE CREATE`
now complete to `ON` as expected, including lowercase input.
I also found that `REVOKE GRANT OPTION FOR CREATE` should reach the same
privilege-completion rule, but the earlier `TailMatches("CREATE")` branch
still intercepts it and offers CREATE object types instead of `ON`.
Perhaps it would be a good idea to cover this form in the same patch. What
do you think?
Thanks,
Sho Ito
On Sun, Oct 4, 2026 at 5:57 PM Haruna Miwa <miwa@sraoss.co.jp> wrote:
Hi,
While testing psql tab completion, I noticed that the generic CREATE
completion rule is triggered after GRANT CREATE and REVOKE CREATE.This results in irrelevant CREATE object type suggestions being offered
in those contexts.I created a patch to exclude GRANT CREATE and REVOKE CREATE from the
generic CREATE completion rule.Regards,
Haruna Miwa
--
Haruna Miwa
--
=======================================
*Sho Ito (Sean)*
E-mail: i.sho.0628@gmail.com
LinkedIn: *https://www.linkedin.com/in/sho-ito-0628/
<https://www.linkedin.com/in/sho-ito-0628/>*
GitHub: https://github.com/sean0628/
=======================================
Hi, Sho
Thank you for testing the patch and for your feedback.
I've updated the patch to also handle the `REVOKE GRANT OPTION FOR CREATE` case,
so it now reaches the same privilege-completion rule and suggests `ON` as expected.
Attached is the updated patch.
Regards,
Haruna
________________________________
From: Sho Ito <i.sho.0628@gmail.com>
Sent: Monday, October 5, 2026 7:03
To: Haruna Miwa <miwa@sraoss.co.jp>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] psql: avoid CREATE command completion after GRANT/REVOKE CREATE
Hi Haruna,
I tested the patch and confirmed that `GRANT CREATE` and `REVOKE CREATE` now complete to `ON` as expected, including lowercase input.
I also found that `REVOKE GRANT OPTION FOR CREATE` should reach the same privilege-completion rule, but the earlier `TailMatches("CREATE")` branch still intercepts it and offers CREATE object types instead of `ON`.
Perhaps it would be a good idea to cover this form in the same patch. What do you think?
Thanks,
Sho Ito
On Sun, Oct 4, 2026 at 5:57 PM Haruna Miwa <miwa@sraoss.co.jp<mailto:miwa@sraoss.co.jp>> wrote:
Hi,
While testing psql tab completion, I noticed that the generic CREATE
completion rule is triggered after GRANT CREATE and REVOKE CREATE.
This results in irrelevant CREATE object type suggestions being offered
in those contexts.
I created a patch to exclude GRANT CREATE and REVOKE CREATE from the
generic CREATE completion rule.
Regards,
Haruna Miwa
--
Haruna Miwa
--
=======================================
Sho Ito (Sean)
E-mail: i.sho.0628@gmail.com<mailto:i.sho.0628@gmail.com>
LinkedIn: https://www.linkedin.com/in/sho-ito-0628/
GitHub: https://github.com/sean0628/
=======================================
Hi Haruna,
Thank you for updating the patch. I tested v2 and confirmed that all three
forms now complete to `ON` as expected.
Now it looks good to me.
Thanks,
Sho
On Tue, Oct 6, 2026 at 4:30 AM Haruna Miwa <miwa@sraoss.co.jp> wrote:
Hi, Sho
Thank you for testing the patch and for your feedback.
I've updated the patch to also handle the `REVOKE GRANT OPTION FOR CREATE`
case,
so it now reaches the same privilege-completion rule and suggests `ON` as
expected.Attached is the updated patch.
Regards,
Haruna------------------------------
*From:* Sho Ito <i.sho.0628@gmail.com>
*Sent:* Monday, October 5, 2026 7:03
*To:* Haruna Miwa <miwa@sraoss.co.jp>
*Cc:* pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
*Subject:* Re: [PATCH] psql: avoid CREATE command completion after
GRANT/REVOKE CREATEHi Haruna,
I tested the patch and confirmed that `GRANT CREATE` and `REVOKE CREATE`
now complete to `ON` as expected, including lowercase input.I also found that `REVOKE GRANT OPTION FOR CREATE` should reach the same
privilege-completion rule, but the earlier `TailMatches("CREATE")` branch
still intercepts it and offers CREATE object types instead of `ON`.Perhaps it would be a good idea to cover this form in the same patch. What
do you think?Thanks,
Sho ItoOn Sun, Oct 4, 2026 at 5:57 PM Haruna Miwa <miwa@sraoss.co.jp> wrote:
Hi,
While testing psql tab completion, I noticed that the generic CREATE
completion rule is triggered after GRANT CREATE and REVOKE CREATE.This results in irrelevant CREATE object type suggestions being offered
in those contexts.I created a patch to exclude GRANT CREATE and REVOKE CREATE from the
generic CREATE completion rule.Regards,
Haruna Miwa
--
Haruna Miwa--
=======================================
*Sho Ito (Sean)*E-mail: i.sho.0628@gmail.com
LinkedIn: *https://www.linkedin.com/in/sho-ito-0628/*
<https://www.linkedin.com/in/sho-ito-0628/>
GitHub: https://github.com/sean0628/
=======================================
--
=======================================
*Sho Ito (Sean)*
E-mail: i.sho.0628@gmail.com
LinkedIn: *https://www.linkedin.com/in/sho-ito-0628/
<https://www.linkedin.com/in/sho-ito-0628/>*
GitHub: https://github.com/sean0628/
=======================================
On Wed, Oct 7, 2026 at 12:24 PM Sho Ito <i.sho.0628@gmail.com> wrote:
Hi Haruna,
Thank you for updating the patch. I tested v2 and confirmed that all three forms now complete to `ON` as expected.
Now it looks good to me.
Thanks for the patch! It looks good to me except for one minor comment.
The source comment in the middle of the conditions is a bit hard to read.
How about moving it above the conditions and explaining why these cases are
excluded? For example:
/* CREATE */
- /* complete with something you can create */
+ /*
+ * Complete with something you can create. If CREATE is a privilege
+ * name, leave it to the GRANT/REVOKE rules below.
+ */
else if (TailMatches("CREATE") &&
-
- /*
- * exclude cases of GRANT/REVOKE CREATE and REVOKE GRANT OPTION FOR
- * CREATE
- */
Regards,
--
Fujii Masao
Fujii-san,
Thank you for your review.
I've attached the revised patch.
Regards,
Haruna Miwa
________________________________
From: Fujii Masao <masao.fujii@gmail.com>
Sent: Wednesday, October 07, 2026 16:43
To: Sho Ito <i.sho.0628@gmail.com>
Cc: Haruna Miwa <miwa@sraoss.co.jp>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] psql: avoid CREATE command completion after GRANT/REVOKE CREATE
On Wed, Oct 7, 2026 at 12:24 PM Sho Ito <i.sho.0628@gmail.com> wrote:
Hi Haruna,
Thank you for updating the patch. I tested v2 and confirmed that all three forms now complete to `ON` as expected.
Now it looks good to me.
Thanks for the patch! It looks good to me except for one minor comment.
The source comment in the middle of the conditions is a bit hard to read.
How about moving it above the conditions and explaining why these cases are
excluded? For example:
/* CREATE */
- /* complete with something you can create */
+ /*
+ * Complete with something you can create. If CREATE is a privilege
+ * name, leave it to the GRANT/REVOKE rules below.
+ */
else if (TailMatches("CREATE") &&
-
- /*
- * exclude cases of GRANT/REVOKE CREATE and REVOKE GRANT OPTION FOR
- * CREATE
- */
Regards,
--
Fujii Masao
On Wed, Oct 7, 2026 at 5:17 PM Haruna Miwa <miwa@sraoss.co.jp> wrote:
Thank you for your review.
I've attached the revised patch.
Thanks for updating the patch! I've pushed it.
BTW, regarding the discussion on the list, could you avoid top-posting?
Bottom-posting is the preferred style on this mailing list.
Regards,
--
Fujii Masao