RE: Psql meta-command conninfo+

From: Maiquel Grassi <grassi(at)hotmail(dot)com(dot)br>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>, Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Erik Wienhold <ewie(at)ewie(dot)name>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Psql meta-command conninfo+
Date: 2024-02-08 20:47:44
Message-ID: CP8P284MB249614E7926043EEF7F063EBEC442@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> v8 no longer throws a permission denied error for non-superusers - it is
> IMHO much nicer this way.
>
> $ /usr/local/postgres-dev/bin/psql postgres -p 5432 -h 127.0.0.1 -U jim
> psql (17devel)
> Type "help" for help.
>
> postgres=# \x
> Expanded display is on.
> postgres=# \conninfo+
> Current Connection Information
> -[ RECORD 1 ]------+----------
> Database | postgres
> Authenticated User | jim
> System User |
> Current User | jim
> Session User | jim
> Session PID | 1321493
> Server Version | 17devel
> Server Address | 127.0.0.1
> Server Port | 5432
> Client Address | 127.0.0.1
> Client Port | 49366
> Socket Directory |
> Host | 127.0.0.1
>
> postgres=# SET ROLE foo;
> SET
> postgres=> \conninfo+
> Current Connection Information
> -[ RECORD 1 ]------+----------
> Database | postgres
> Authenticated User | jim
> System User |
> Current User | foo
> Session User | jim
> Session PID | 1321493
> Server Version | 17devel
> Server Address | 127.0.0.1
> Server Port | 5432
> Client Address | 127.0.0.1
> Client Port | 49366
> Socket Directory |
> Host | 127.0.0.1
>
> The patch now applies cleanly.
>
> One thing I just noticed. The psql autocomplete feature does not suggest
> the new + option of \conninfo. For instance, when typing "\connin[TAB]"
> it automatically autocompletes to "\conninfo ". I guess it should also
> be included in this patch.
>
> I can do a more thorough review of the code when you add the
> documentation and tests to the patch.
>
> Thanks!

--//--

Hi Jim,

It's not a psql standard to use tab-complete for commands ending with +.
You can verify this in the /* psql's backslash commands. */ section of
the file "/src/bin/psql/tab-complete.c".

https://github.com/postgres/postgres/blob/fdfb92c0307c95eba10854196628d88e6708901e/src/bin/psql/tab-complete.c

In v9, I started the documentation work and am open to suggestions.

> "I can do a more thorough review of the code when you add the

> documentation and tests to the patch."

Soon I'll be developing the tests. And that will be welcome.

Thanks a lot!

Regards,
Maiquel Grassi.

Attachment Content-Type Size
v9-0001-psql-meta-command-conninfo-plus.patch application/octet-stream 9.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-02-08 21:33:12 Re: Where can I find the doxyfile?
Previous Message Tom Lane 2024-02-08 20:39:29 Re: glibc qsort() vulnerability