Re: Tab completion for large objects - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Tab completion for large objects
Date
Msg-id CAHGQGwHfzMsFJt3-q5ixGsa0Mu9peqLMv+7_OmnLGLRpkuYggQ@mail.gmail.com
Whole thread Raw
In response to Re: Tab completion for large objects  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
On Wed, Jul 9, 2025 at 7:46 PM Fujii Masao <masao.fujii@oss.nttdata.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

pgsql-hackers by date:

Previous
From: "cca5507"
Date:
Subject: Re: Logical replication launcher did not automatically restart when got SIGKILL
Next
From: Tender Wang
Date:
Subject: A little cosmetic to convert_VALUES_to_ANY()