Re: Tab completion for large objects

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Tab completion for large objects
Date: 2025-07-27 07:00:01
Message-ID: CAHGQGwHfzMsFJt3-q5ixGsa0Mu9peqLMv+7_OmnLGLRpkuYggQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 9, 2025 at 7:46 PM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>
>
>
> On 2025/07/09 3:50, Dagfinn Ilmari Mannsåker wrote:
> > Hi hackers,
> >
> > I noticed that psql's tab completion suggested TO immediately after
> > GRANT ... ON LARGE OBJECT, and not after ON LARGE OBJECT <oid>. This is
> > because LARGE OBJECT is the only two-word object type, so it thinks
> > LARGE is the object type and OBJECT is the name. Attached are three
> > patches that address this and other LO-related tab completion issues:
> >
> > 1. Tab complete OBJECT after GRANT|REVOKE ... ON LARGE, and TO/FROM
> > after GRANT|REVOKE ... ON LARGE OBJECT
>
> Thanks for the patches!
>
> Regarding the 0001 patch, Nagata-san already proposed a similar patch in [1].
> His version handles not only "LARGE OBJECT" but also another two-word object type,
> "FOREIGN SERVER".

I think it's worth applying patch 0002 and part of 0001, so I've merged
those changes into a single patch. Patch attached. Any thoughts?

+ else if (TailMatches("LARGE"))
+ COMPLETE_WITH("OBJECT");

It seems the "ALTER DEFAULT PRIVILEGES ... LARGE" case was missed
here. In that context, we should complete with "OBJECTS" instead of
"OBJECT". I've fixed that in the patch.

As for patch 0003, I'm not sure it adds much value. It's probably hard
for most users to choose the correct OID from the list of large object
OIDs provided by tab-completion.

Regards,

--
Fujii Masao

Attachment Content-Type Size
v2-0001-psql-Improve-tab-completion-for-large-object.patch application/octet-stream 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tender Wang 2025-07-27 07:53:12 A little cosmetic to convert_VALUES_to_ANY()
Previous Message cca5507 2025-07-27 06:13:24 Re: Logical replication launcher did not automatically restart when got SIGKILL