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

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: More CppAsString2() in psql's describe.c
Date: 2024-12-02 11:26:47
Message-ID: 21ec3fa4-e30d-4941-b980-7636b9061be0@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2024-12-02 11:33:38 RE: Conflict detection for update_deleted in logical replication
Previous Message Peter Eisentraut 2024-12-02 11:13:56 Re: Proper object locking for GRANT/REVOKE