Re: Would it be possible to add functions to tab-completion in psql?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Ron <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Would it be possible to add functions to tab-completion in psql?
Date: 2022-08-16 14:02:53
Message-ID: 20220816140253.GB14225@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 16, 2022 at 08:51:49AM -0500, Ron wrote:
> On 8/16/22 08:01, hubert depesz lubaczewski wrote:
> > On Tue, Aug 16, 2022 at 07:42:27AM -0500, Ron wrote:
> > > On 8/16/22 07:28, hubert depesz lubaczewski wrote:
> > > > Hi,
> > > > As a dba I have to, very often, query system functions, starting with
> > > > pg_last_xact_replay_timestamp and pg_current_wal_lsn.
> > > >
> > > > Would it be possible/hard/expensive, to change tab-completion so that:
> > > >
> > > > select pg_<tab> would work?
> > > It does, in the psql 9.6 and 12 that I installed from it's native
> > > repositories, and the psql 12 installed from RHEL 7/8 native repositories.
> > Hmm .. I'm on Pg 16, linked with readline, and pressing tab after
>
> Pg *16*??

Yes. I use dev pg on daily basis.

> > select pg_
> > just produces new prompt:
> >
> > https://asciinema.org/a/A8w16KhXF7bK4iz7hE7iyyo0D
> >
> > Can you please show me this working, with "which psql", and "ldd $(
> > which psql )" using asciinema?
>
> $ alias psql12
> alias psql12='/usr/lib/postgresql/12/bin/psql -p5433'
>
> $ psql12
> psql (12.11 (Ubuntu 12.11-1.pgdg18.04+1))
> Type "help" for help.
>
> postgres=# select * from pg_<tab>
> Display all 130 possibilities? (y or n)

Please note that this example is not really relevant to what I asked
about.

First of all, I asked about `select pg_<tab>`, and not `select * from
pg_<tab>`, second this tab completion lists tables and views that have
names starting with pg_*.

And I asked about functions.

I know we can tab-complete relations. But we can't functions.

Best regards,

depesz

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-08-16 14:10:55 Re: Would it be possible to add functions to tab-completion in psql?
Previous Message hubert depesz lubaczewski 2022-08-16 13:59:12 Re: Would it be possible to add functions to tab-completion in psql?