More CppAsString2() in psql's describe.c
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-10-22T00:49:10Z
Lists: pgsql-hackers
Attachments
- 0001-psql-Sprinkle-more-CppAsString2-in-describe.c.patch (text/x-diff) patch 0001
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
Commits
-
psql: Sprinkle more CppAsString2() in describe.c
- 18954ce7f69b 18.0 landed