RE: Psql meta-command conninfo+

Maiquel Grassi <grassi@hotmail.com.br>

From: Maiquel Grassi <grassi@hotmail.com.br>
To: Jim Jones <jim.jones@uni-muenster.de>, Pavel Luzanov <p.luzanov@postgrespro.ru>, Nathan Bossart <nathandbossart@gmail.com>
Cc: Erik Wienhold <ewie@ewie.name>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2024-02-08T20:47:44Z
Lists: pgsql-hackers

Attachments

> 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.

Commits

  1. psql: Change new \conninfo to use SSL instead of TLS

  2. Change \conninfo to use tabular format

  3. Update extension lookup routines to use the syscache

  4. Improve COPY TO performance when server and client encodings match

  5. doc: Remove superfluous bracket in synopsis

  6. Remove psql support for server versions preceding 9.2.