Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rYSsi-00G8CU-CA for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Feb 2024 15:33:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rYSsg-009YPH-Dh for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Feb 2024 15:33:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rYSsg-009YP8-2O for pgsql-hackers@lists.postgresql.org; Fri, 09 Feb 2024 15:33:34 +0000 Received: from mail-cpzbra01olkn2088.outbound.protection.outlook.com ([40.92.97.88] helo=BRA01-CPZ-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rYSsc-006Jx9-GY for pgsql-hackers@postgresql.org; Fri, 09 Feb 2024 15:33:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d4jeuL9TTJheVaV0BQUfMZYzHYxUKmPBv7yYvBNJJOpBLo7ZG7iluSz2u5317ZtlhlgvU6NlYVZPW5rO4NGxZvZ7gbPby2ikvd5lx7OV94EStok3Kh/cuvV+BRIOm8E7tnojagRvim5LBpXcagCMHDeRNJR9IthsBiv/y1mez+0ixi9FTZ/EEz2KLjvhmEwpsucwZp9Yky6FjAWweszGHk3Mwmru1pQDmPY6g/B3A6FMqPH9SDYuzcwf2A+RhsUeV4Kjb0XMjCKQa+pHZZCUvhkexlvCwyJobLN4MYrG/7YQBLAIAUV0u/FSNTdoFYJ6c3+/N9iUVGRF53IuVWZhgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=To1NfdKlYQXnUYcSITho+V0GESNBy2cY1T415bUy/tM=; b=V156cxnHPOtShTCKfKKCQyD83RXSPEM8O77bMVjVNllvqz5k4Ep1B51B17dmJ78DEo0LW9kflnIYLmSMMBFH7nkpk2zS9aPKNEQ6wXZI3dpS2m2SHOB8M962yxMzTRjmKvYpg1/22BCnK/65UcbA12RcC4elrrGhSXWMgpE7XeNUHIrCs+iBofJYmg9QuBZ6Awwc3oaCZDvmWdB4x6hew1OfcAiJnT1N3/P5jdVtwXuk5W1q+Mh0TDGOJ8mMnl6sopMmfso51bD3WK3zWXkdjdKEl3/PnbnVthwohglD+Y4HMon/WLptbAu6uqP/MBEUr6/KtNy3Mt2XwxQK6Yj+0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM (2603:10d6:103:2dc::11) by CP8P284MB2413.BRAP284.PROD.OUTLOOK.COM (2603:10d6:103:2db::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.27; Fri, 9 Feb 2024 15:33:23 +0000 Received: from CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM ([fe80::ce6:bf75:3d4a:97cf]) by CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM ([fe80::ce6:bf75:3d4a:97cf%6]) with mapi id 15.20.7270.025; Fri, 9 Feb 2024 15:33:23 +0000 From: Maiquel Grassi To: Alvaro Herrera CC: Erik Wienhold , Jim Jones , Pavel Luzanov , Nathan Bossart , "pgsql-hackers@postgresql.org" Subject: RE: Psql meta-command conninfo+ Thread-Topic: Psql meta-command conninfo+ Thread-Index: AQHaWRQuU7L2MD2CX0quiO/hLxQK8bD9n9eAgAAOagCAABlrgoAABsOAgAABrYCAAAkRMoAAAaIAgABfmwKAAJe3AIAAHVoLgAAnEwCAADA+O4ABA4CAgABCa76AAE2sAIAAENYAgAAZLj6AAMw/gIAAU5hL Date: Fri, 9 Feb 2024 15:33:23 +0000 Message-ID: References: <202402091019.y3psh2m7sqbv@alvherre.pgsql> In-Reply-To: <202402091019.y3psh2m7sqbv@alvherre.pgsql> Accept-Language: pt-BR, en-US Content-Language: pt-BR X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [JwP0LfUgFCegobUTo+RoA7v+gYkLxrAS] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CP8P284MB2496:EE_|CP8P284MB2413:EE_ x-ms-office365-filtering-correlation-id: 2de98477-5d95-4570-74c2-08dc298473ba x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cr0F4nJjMxa/sJFzRHvf/ext7UeBAmRm8BeN5GIB4XUgYgtOuAWLa+AN3iZTLucaf3cAIlHQgoYrlCrC033/Yyq8faVgMngXnjRLamJJpCuGWLv8P52d5Ovi1DhnoKwX86wzWkMU44jF5DqtW8h/s/6eLWcRc9zPhVGXK2yP0MrClVCxZUkfING+kMyNat24LfIT34DoMIbbEqAGfJigY+xPP1rpifYWdzjRDaUmbqpHvzEGS39bYRUXOKxJXz8c1mlvwoXs7fcVyl9k8Iv7wlZquGrI8YpXasHBflsfH9vkruuv5PevBpzx5qF3svlwULKMeQ9BJarUUFEIqi95QxNi9UsiZV71n+19qc77MvpLxJx1yA8iId89V2jvfzb9Nx61po2+3wC4WkCLVe/PyKCqXxBVcq3yR5+gQQHeaY3PcF5IPF/ry7Chr+LYueKp6qFOf317bTTvk+aAJh5CfyKxAbzKwqmNv2owbPO0SnjHsivBX1WeQUahwe5LnvTd9E9zt6EvyZDF6UTSq32PG7B8gG9VRa29jhmrPIWHC/akxBf2BVV+FzokARe7owbt x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?/Y2qFSBcyBrzM4nnJMMeMkYUQrWFuK/FSech1iug7wudWRg4Wm1Yy32p4p?= =?iso-8859-1?Q?yeQavb0dazH8em/4Wrt9QMtFFwz5R3G4An1hYk0sfuqoz1g5y7nqcnfy64?= =?iso-8859-1?Q?6brjgHURw/TX3mqR34eQOgKtUddJ4F1NFqnF9/cFE3d2Y7xC9F+fqN0zfS?= =?iso-8859-1?Q?EY5JjO5HZjRrlREhI7aSP5VAsu4N1SnC+ltjjewdodjoCXqg/OHrvDPQRK?= =?iso-8859-1?Q?XoeEh7kOinqtzt5kFuc14TGG/aB5hnFYb3+Mq6jrDplFe0hhJDeCzbnb11?= =?iso-8859-1?Q?k3QNHq0tQZ2mFCyrOCVmndyGmJJ4wEM6J9eJ1diFNcmbJgaWxvtArMmdTV?= =?iso-8859-1?Q?tfiP1IOEjWhwzRC4yfQ6q9SN4dhJ+/a/OwChcawfOIJjjRk48pIPvipCfR?= =?iso-8859-1?Q?aFG+abiunl8ePGuEqaOjJf2HiezkMV1/PyHRrzE7+ynHhX2GQRUnSawErR?= =?iso-8859-1?Q?fXsIXpCUqbqjhlwqyypyHhuUDJWfyiCbu7RhkUBj8DGtFnhQOmBIsBrJl0?= =?iso-8859-1?Q?P0jqrhFYBzIFFOmtqruoh1qISWCjlSflDs5sbq+aszo2IUf+PlAGD93N96?= =?iso-8859-1?Q?WnluAR0HrrjjF3+fuEj1UJtd2KAn0YUdWtAhFP9OjqmpbE8Q4QWs3Qr71g?= =?iso-8859-1?Q?jK7ejP7xFwysdovKoujdBUUv3eGgu3+LwArox/zc5SyMWpOHt6kULRiTWh?= =?iso-8859-1?Q?hhvSXDc+jzaYaA+9XPzP/LY7QsQtrFiLx8be7Kl5edqqSuwCkBOdwPNsGC?= =?iso-8859-1?Q?oM/gr7bpekWGyCYoumMJ9JSHoIp4gb4Lb4K9hOdodcjx1MwvUP69wFv2F9?= =?iso-8859-1?Q?YEXO1TGfD5S8tPtFmlBBQO05Hpoa2zRfHpBDNEMsmZCK41+cyPj9eV3of5?= =?iso-8859-1?Q?GLC6WaWiDnk/QzUqnaCyXQckZ49JmuDIWH7y0g2XsaLRMDoJCLbqW0J2as?= =?iso-8859-1?Q?HyGx92fxRYWpqt9oTF08BnT13i4R1HtXgJ+USykYcPVEMooZSJQBkBysv0?= =?iso-8859-1?Q?K7i7FEO1b6L+bSVQXgxyW6agicKuJqGoDRhGPNVNaAk/Hv7Qlp6AHHm1hn?= =?iso-8859-1?Q?16J792GQT/Uk9KQQdtxYrGzEbTOlp6xXEclY+k+F/pb1zaStlotthicBDj?= =?iso-8859-1?Q?h8Q7CgDUf6MOsstDBqO39AVsLDQ5bY9n2oI2pGgLnqWUsL8ftdP46Aoh5K?= =?iso-8859-1?Q?EnUFpXyMqmXR1gGimy2uzv4h0Ylp7Brtf2rYLt6BMsbRVsNWx+bHsqsjyG?= =?iso-8859-1?Q?iCS1HQjp5gfrYKZDUxdQ=3D=3D?= Content-Type: multipart/alternative; boundary="_000_CP8P284MB24963D11AD78926C02F22853EC4B2CP8P284MB2496BRAP_" MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-0f7b9.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 2de98477-5d95-4570-74c2-08dc298473ba X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Feb 2024 15:33:23.3672 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CP8P284MB2413 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_CP8P284MB24963D11AD78926C02F22853EC4B2CP8P284MB2496BRAP_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable >Hmm, I noticed that this would call printSSLInfo() and printGSSInfo() >after listConnectionInformation. It would be much better to show these >in tabular format as well and remove the calls to printSSL/GSSInfo. > >I propose additional columns to the same \conninfo+ table; when SSL, >like this: > >Database | postgres >[...] >Host | 127.0.0.1 >Encryption | SSL >Protocol | PQsslAttribute(protocol) >Cipher | PQsslAttribute(cipher) >Compression | PQsslAttribute(compression) > >When GSS, like this > >Database | postgres >[...] >Host | 127.0.0.1 >Encryption | GSS > >(why don't we print anything else in printGSSInfo()? That's weird.) --//-- Hi =C1lvaro, Thank you for the suggestion. I will remove printSSLInfo() and printGSSInfo= () and incorporate the suggested fields into the tabular result of "\conninfo+". If it's necessary to adjust printGSSInfo(), we can work on that as well. At= first glance, I leave it open for others to analyze and give their opinion. I'd also like to ask for help with a difficulty. Currently, I'm working on resolving this situation (highlighted by Pavel Luzanov). How can we make \conninfo return the same message as \conninfo+ after closing the current session in another session with pg_terminate_backend(pid)? [postgres@localhost bin]$ ./psql psql (17devel) Type "help" for help. postgres=3D# \conninfo You are connected to database "postgres" as user "postgres" via socket in "= /tmp" at port "5432". postgres=3D# \conninfo+ Cu= rrent Connection Information Database | Authenticated User | System User | Current User | Session User = | Backend PID | Server Address | Server Port | Client Address | Client Port= | Socket Directory | Host ----------+--------------------+-------------+--------------+--------------= +-------------+----------------+-------------+----------------+------------= -+------------------+------ postgres | postgres | | postgres | postgres = | 17281 | | 5432 | | = | /tmp | (1 row) postgres=3D# 2024-02-09 09:15:24.152 -03 [17281] FATAL: terminating connec= tion due to administrator command postgres=3D# \conninfo You are connected to database "postgres" as user "postgres" via socket in "= /tmp" at port "5432". postgres=3D# \conninfo+ FATAL: terminating connection due to administrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Succeeded. postgres=3D# Tks a lot! Maiquel Grassi. --_000_CP8P284MB24963D11AD78926C02F22853EC4B2CP8P284MB2496BRAP_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

>= ;Hmm, I noticed that this would call printSSLInfo() and printGSSInfo()
>after listConnectionInformation.  It would be much better to show = these
>in tabular format as well and remove the calls to printSSL/GSSInfo.
>
>I propose additional columns to the same \conninfo+ table; when SSL, >like this:
>
>Database           | = postgres
>[...]
>Host           &= nbsp;   | 127.0.0.1
>Encryption         | SSL
>Protocol           | = PQsslAttribute(protocol)
>Cipher           = ;  | PQsslAttribute(cipher)
>Compression        | PQsslAttribute(= compression)
>
>When GSS, like this
>
>Database           | = postgres
>[...]
>Host           &= nbsp;   | 127.0.0.1
>Encryption         | GSS
>
>(why don't we print anything else in printGSSInfo()?  That's weird= .)

--//--

Hi =C1lvaro,

= Thank you for the suggestion. I will remove printSSLI= nfo() and printGSSInfo() and
incorporate the suggested fields into the tabular result of "\conninfo= +".


If it's necessary to adjust printGSSInfo(), we can work on that as well. At= first
glance, I leave it open for others to analyze and give their opinion.


I'd also like to ask for help with a difficulty. Currently, I'm working on<= /span>

resolving this situation = (highlighted by Pavel Luzanov). How can we
make \conninfo return the same message as \conninfo+ after closing
the current session in another session with pg_terminate_backend(pid)?

[postgres@localhost bin]$ ./psql

psql (17devel)
Type "help" for help.

postgres=3D# \conninfo
You are connected to database "postgres&quo= t; as user "postgres" via socket in "/tmp" at port &quo= t;5432".
postgres=3D# \conninfo+
             =                     &nbs= p;                     &n= bsp;                Current Connect= ion Information
 Database | Authenticated User | System Use= r | Current User | Session User | Backend PID | Server Address | Server Por= t | Client Address | Client Port | Socket Directory | Host
----------+--------------------+-------------+--= ------------+--------------+-------------+----------------+-------------+--= --------------+-------------+------------------+------
 postgres | postgres       &= nbsp;   |             | postgres   =   | postgres     |       17281 |    = ;            | 5432       &nbs= p;|                |     =         | /tmp             |
(1 row)

postgres=3D# 2024-02-09 09:15:24.152 -03 [17281]= FATAL:  terminating connection due to administrator command

postgres=3D# \conninfo
You are connected to database "postgres&quo= t; as user "postgres" via socket in "/tmp" at port &quo= t;5432".
postgres=3D# \conninfo+
FATAL:  terminating connection due to admin= istrator command
server closed the connection unexpectedly=
        This probably means = the server terminated abnormally
        before or while proc= essing the request.
The connection to the server was lost. Attemptin= g reset: Succeeded.
postgres=3D#

Tks a lot!
Maiquel Grassi.
--_000_CP8P284MB24963D11AD78926C02F22853EC4B2CP8P284MB2496BRAP_--