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 1rY2AN-00DxwY-G9 for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Feb 2024 11:02:04 +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 1rY2AM-00GtL9-IV for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Feb 2024 11:02:02 +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 1rY2AM-00GtKr-51 for pgsql-hackers@lists.postgresql.org; Thu, 08 Feb 2024 11:02:02 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY2AH-00674d-8n for pgsql-hackers@postgresql.org; Thu, 08 Feb 2024 11:02:01 +0000 Received: from [172.30.2.118] (unknown [172.30.2.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: p.luzanov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id C48DCE210D7; Thu, 8 Feb 2024 14:01:55 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1707390115; bh=rtjcSJI5T33nm6+H49EPbVOSyufTugy6oZlgOTLj44o=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=E9JLmiy9M6eSgJZm6wV38HWeGgi6epaCQiQcvRV9P0KJtUkkMjzjzO8Q8XIsAeXTg +jmW3tsQmpH2y8zfkVoTKiZTQrgnmfbA3zE0O3dBhcSF5kDbvRf42G/Q7C0IOcc/Vy spixMMYuolDZINPyPWjE9anogC+hxsBizqRVVyO+gXBKggbrjPBrJJLvFMB0+HXBNd zD5C+BMrhiRwV6n9fytgr+SUA8W2tksuETfoBZHqZDTdMLT9vRtZEqqQTU4AQy2/bu xh5yjOVFpkp+U1TgLVObpAg+kcPdv/nv7qBmrnFKUTNgY1SBURPo/l0WlhE61a3NxZ vHZo6fyUelxdA== Content-Type: multipart/alternative; boundary="------------ZEIF8zTTY8yuoHzkjwx8Dq69" Message-ID: Date: Thu, 8 Feb 2024 14:01:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Psql meta-command conninfo+ Content-Language: en-US, ru-RU To: Maiquel Grassi , Nathan Bossart Cc: Erik Wienhold , "pgsql-hackers@postgresql.org" References: <20240206181919.GA3853632@nathanxps13> <20240206210605.GA3903769@nathanxps13> <20240206211205.GA3903996@nathanxps13> <20240206215022.GA3452@nathanxps13> <852cabef-f596-4826-9a54-d3f75d9a6cc8@postgrespro.ru> From: Pavel Luzanov In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------ZEIF8zTTY8yuoHzkjwx8Dq69 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 07.02.2024 23:13, Maiquel Grassi wrote: > Regarding the "system_user" function, as it is relatively new, I added > the necessary handling to avoid conflicts with versions lower than > version 16. > Yes, that's rights. A couple of doubts about the implementation details. But keep in mind that I'm not very good at programming in the C language. I hope for the help of more experienced developers. 1. + if (db == NULL) + printf(_("You are currently not connected to a database.\n")); This check is performed for \conninfo, but not for \conninfo+. 2. Some values (address, socket) are evaluated separately for \conninfo (via C functions) and for \conninfo+ (via sql functions). It may be worth evaluating them in one place. But I'm not sure about that. The final version of the patch will require changes to the documentation and tests. -- Pavel Luzanov Postgres Professional:https://postgrespro.com --------------ZEIF8zTTY8yuoHzkjwx8Dq69 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Hi,

On 07.02.2024 23:13, Maiquel Grassi wrote:

Regarding the "system_user" function, as it is relatively new, I added the necessary handling to avoid conflicts with versions lower than version 16.

Yes, that's rights.

A couple of doubts about the implementation details.
But keep in mind that I'm not very good at programming in the C language.
I hope for the help of more experienced developers.


1.
+			if (db == NULL)
+				printf(_("You are currently not connected to a database.\n"));

This check is performed for \conninfo, but not for \conninfo+.


2.
Some values (address, socket) are evaluated separately for \conninfo
(via C functions) and for \conninfo+ (via sql functions).
It may be worth evaluating them in one place. But I'm not sure about that.

The final version of the patch will require changes to the documentation and tests.

-- 
Pavel Luzanov
Postgres Professional: https://postgrespro.com
--------------ZEIF8zTTY8yuoHzkjwx8Dq69--