Re: Using defines for protocol characters - Mailing list pgsql-hackers

From Dave Cramer
Subject Re: Using defines for protocol characters
Date
Msg-id CADK3HH+-=08kd-aNCOP9s7fCZHUxrUBvVx5cyBJZzHD49wzPQA@mail.gmail.com
Whole thread Raw
In response to Re: Using defines for protocol characters  (Tatsuo Ishii <ishii@sraoss.co.jp>)
Responses Re: Using defines for protocol characters
Re: Using defines for protocol characters
List pgsql-hackers



On Thu, 3 Aug 2023 at 16:59, Tatsuo Ishii <ishii@sraoss.co.jp> wrote:
> On Thu, 3 Aug 2023 at 13:25, Tatsuo Ishii <ishii@sraoss.co.jp> wrote:
>
>> > Greetings,
>> >
>> > Attached is a patch which introduces a file protocol.h. Instead of using
>> > the actual characters everywhere in the code this patch names the
>> > characters and removes the comments beside each usage.
>>
>> > +#define DESCRIBE_PREPARED           'S'
>> > +#define DESCRIBE_PORTAL             'P'
>>
>> You use these for Close message as well. I don't like the idea because
>> Close is different message from Describe message.
>>
>> What about adding following for Close too use them instead?
>>
>> #define CLOSE_PREPARED           'S'
>> #define CLOSE_PORTAL             'P'
>>
>
> Good catch.
> I recall when writing this it was a bit hacky.
> What do you think of PREPARED_SUB_COMMAND   and PORTAL_SUB_COMMAND instead
> of duplicating them ?

Nice. Looks good to me.
New patch attached which uses  PREPARED_SUB_COMMAND   and PORTAL_SUB_COMMAND instead
and uses 
PQMSG_REQ_* and  PQMSG_RESP_*  as per Alvaro's suggestion

Dave Cramer
Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Use of additional index columns in rows filtering
Next
From: Tom Lane
Date:
Subject: Re: Fix incorrect start up costs for WindowAgg paths (bug #17862)