RE: Psql meta-command conninfo+ - Mailing list pgsql-hackers

From Maiquel Grassi
Subject RE: Psql meta-command conninfo+
Date
Msg-id CP8P284MB249652F5F0BE828C20A38348EC442@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: Psql meta-command conninfo+  (Pavel Luzanov <p.luzanov@postgrespro.ru>)
Responses Re: Psql meta-command conninfo+
List pgsql-hackers
> 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.

--//--

Hi Pavel,

First of all, thank you very much for your observations.

1. The connection check for the case of \conninfo+ is handled by "describe.c" itself since it deals with queries. I might be mistaken, but I believe that by using "printQuery()" via "describe.c", this is already ensured, and there is no need to evaluate the connection status.

2. I believe that by implementing the evaluations separately as they are, it becomes easier to perform future maintenance by minimizing the mixing of C code with SQL code as much as possible. However, certainly, the possibility of a better suggestion than mine remains open.

Regards,
Maiquel O. Grassi.

pgsql-hackers by date:

Previous
From: Ilia Evdokimov
Date:
Subject: Re: pg_stat_advisor extension
Next
From: Peter Eisentraut
Date:
Subject: Re: Sequence Access Methods, round two