On Sat, Feb 17, 2024 at 02:53:43PM +0000, Maiquel Grassi wrote: > The "pg_stat_ssl" view is available from >= PG 9.5, and the "pg_stat_gssapi" > view is > available from >= PG 12. The "compression" column was removed from the > "pg_stat_ssl" from >= PG 14. All of these cases introduce greater complexity > in > maintaining the SQL. The central idea from the beginning has always been to > show > the user all the information from \conninfo and extend it in \conninfo+.
IMHO we should use the views whenever possible (for the reason stated above [0]). I think it's okay if we need to fall back to a different approach for older versions. But presumably we'll discontinue psql support for these old server versions at some point, at which point we can simply delete the dead code that doesn't use the views. > The absence > of the "compression" column in version 14 and above makes dealing with this > even > more complicated, and not showing it seems to contradict \conninfo. I would be okay with using PQsslAttribute() for all versions for this one since any remaining support for this feature is on its way out. Once psql no longer supports any versions that allow SSL compression, we could probably remove it from \conninfo[+] completely or hard-code it to "off". > SSL support has been available since version 7.1 (see documentation); if > there was > > support before that, I can't say. In this regard, it may seem strange, but > there are still > many legacy systems running older versions of PostgreSQL. Just yesterday, I > assisted > a client who is still using PG 8.2. In these cases, using the "pg_stat_ssl" > and > "pg_stat_gssapi" views would not be possible because they don't exist on the > server. > I believe that psql should cover as many cases as possible when it comes to > compatibility > with older versions (even those no longer supported). In this case, > concerning SSL and > GSS, I think libpq is better prepared to handle this. At the moment, the psql support cutoff appears to be v9.2 (see commit cf0cab8), which has been out of support for over 6 years. If \conninfo+ happens to work for older versions, then great, but I don't think we should expend too much energy in this area. [0] https://postgr.es/m/20240216155449.GA1236054%40nathanxps13 -- Nathan Bossart Amazon Web Services: https://aws.amazon.com