More CppAsString2() in psql's describe.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: More CppAsString2() in psql's describe.c
Date: 2024-10-22 00:49:10
Message-ID: Zxb2hpca-pZc6zKe@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

This was on my stack of things for some time, but please find attached
a patch to clean up some code with $subject because HEAD's describe.c
is a mixed bag of relying on CppAsString2() and hardcoded values.
Switching to CppAsString2() has the advantage to make the code more
self-documented, so as it is not necessary to remember what a single
byte means in a catalog.

I should have caught most of them, with exceptions related to
policies, subscriptions and dependencies being intentional.

I have noticed that describe.c includes pg_am.h and not pg_am_d.h.
That's not a good idea even if it is OK now because this has the risk
of pulling backend-side definitions into psql. psql -E reported
consistent formats in the queries generated, so things look in rather
good shape here.

Note that there were a couple of value checks not part of the queries
that relied on values from the catalogs for some relpersistences and
replidents. I've fixed them while on it.

Thoughts or comments are welcome.
--
Michael

Attachment Content-Type Size
0001-psql-Sprinkle-more-CppAsString2-in-describe.c.patch text/x-diff 19.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Shinoda, Noriyoshi (SXD Japan FSIP) 2024-10-22 00:50:56 RE: Statistics Import and Export
Previous Message Melanie Plageman 2024-10-22 00:45:32 EXPLAIN IndexOnlyScan shows disabled when enable_indexonlyscan=on