Re: More CppAsString2() in psql's describe.c

2024-12-02 Thread Daniel Gustafsson
> On 2 Dec 2024, at 08:52, Tom Lane wrote: > But isn't there a way to improve the macro so this'd lead to an error? That sounds like a pretty decent improvement in general. I experimented with quick hack using a typeof check on the passed symbol which catches symbolname typos. It might be total

Re: More CppAsString2() in psql's describe.c

2024-12-02 Thread Peter Eisentraut
On 02.12.24 08:52, Tom Lane wrote: (Moreover, the current structure assumes that the C character literal syntax used by the PROKIND_* and other symbols happens to be the same as the SQL string literal syntax required in those queries, which is just an accident.) So? There isn't much about C syn

Re: More CppAsString2() in psql's describe.c

2024-12-02 Thread Peter Eisentraut
On 28.11.24 07:34, Michael Paquier wrote: - "WHERE p.prokind = 'a'\n", + "WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n", I noticed something here. If the symbol that is the argument of

Re: More CppAsString2() in psql's describe.c

2024-12-01 Thread Tom Lane
Peter Eisentraut writes: > On 28.11.24 07:34, Michael Paquier wrote: >> - "WHERE p.prokind = 'a'\n", >> + "WHERE p.prokind = " >> CppAsString2(PROKIND_AGGREGATE) "\n", > I noticed something here. If the sy

Re: More CppAsString2() in psql's describe.c

2024-12-01 Thread Daniel Gustafsson
> On 2 Dec 2024, at 08:37, Peter Eisentraut wrote: > the current structure assumes that the C character literal syntax used by the > PROKIND_* and other symbols happens to be the same as the SQL string literal > syntax required in those queries, which is just an accident.) I'm not sure I would

Re: More CppAsString2() in psql's describe.c

2024-11-28 Thread Tom Lane
Daniel Gustafsson writes: > On 28 Nov 2024, at 19:25, Corey Huinker wrote: >>> I sort of wish we had a shorter macro as CppAsString2() get's pretty verbose >>> when used frequently like this. >> I don't quite understand the etymology of the name (it's some variation on >> C++'s std::to_string,

Re: More CppAsString2() in psql's describe.c

2024-11-28 Thread Michael Paquier
On Thu, Nov 28, 2024 at 10:40:35AM +0100, Daniel Gustafsson wrote: > LGTM, I didn't scan for omissions but the ones in the patch look right to me. > I sort of wish we had a shorter macro as CppAsString2() get's pretty verbose > when used frequently like this. Thanks for the reviews, applied what I

Re: More CppAsString2() in psql's describe.c

2024-11-28 Thread Daniel Gustafsson
> On 28 Nov 2024, at 19:25, Corey Huinker wrote: >> LGTM, I didn't scan for omissions but the ones in the patch look right to me. >> I sort of wish we had a shorter macro as CppAsString2() get's pretty verbose >> when used frequently like this. > > I don't quite understand the etymology of the n

Re: More CppAsString2() in psql's describe.c

2024-11-28 Thread Corey Huinker
> > > LGTM, I didn't scan for omissions but the ones in the patch look right to > me. > I sort of wish we had a shorter macro as CppAsString2() get's pretty > verbose > when used frequently like this. > I don't quite understand the etymology of the name (it's some variation on C++'s std::to_string

Re: More CppAsString2() in psql's describe.c

2024-11-28 Thread Daniel Gustafsson
> On 28 Nov 2024, at 07:34, Michael Paquier wrote: > > On Tue, Oct 22, 2024 at 09:49:10AM +0900, Michael Paquier wrote: >> 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

Re: More CppAsString2() in psql's describe.c

2024-11-27 Thread Corey Huinker
> > Any objections against applying it? > +1. No objections. It's a great help in communicating meaning.

Re: More CppAsString2() in psql's describe.c

2024-11-27 Thread Michael Paquier
On Tue, Oct 22, 2024 at 09:49:10AM +0900, Michael Paquier wrote: > 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. So, thi