Re: More CppAsString2() in psql's describe.c - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: More CppAsString2() in psql's describe.c
Date
Msg-id 21ec3fa4-e30d-4941-b980-7636b9061be0@eisentraut.org
Whole thread Raw
In response to Re: More CppAsString2() in psql's describe.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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 syntax that isn't an accident.
> Neither literal syntax is going to change, so I don't see why
> it's problematic to rely on them being the same.

For example, if you write

#define          RELKIND_RELATION        '\x72'

then it won't work anymore.

I was also curious whether

#define FOO 'r'
#define RELKIND_RELATION FOO

would work.  It appears it does.  But this syntactic construction is 
quite hard to completely understand currently.





pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Proper object locking for GRANT/REVOKE
Next
From: Michael Christofides
Date:
Subject: Re: Proposals for EXPLAIN: rename ANALYZE to EXECUTE and extend VERBOSE