[PATCH] Refactor pqformat.{c,h} and protocol.h - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject [PATCH] Refactor pqformat.{c,h} and protocol.h
Date
Msg-id CAJ7c6TNTd09AZq8tGaHS3LDyH_CCnpv0oOz2wN1dGe8zekxrdQ@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] Refactor pqformat.{c,h} and protocol.h
Re: [PATCH] Refactor pqformat.{c,h} and protocol.h
List pgsql-hackers
Hi,

While investigating a bug report [1] I wanted to find all the pieces
of code that form PqMsg_DataRow messages and couldn't easily do it.
This is because one authors prefer writing:

pq_beginmessage(buf, 'D');

.. while others:

pq_beginmessage(buf, PqMsg_DataRow);

The proposed patchset fixes this.

- Patch 1 replaces all the char's with PqMsg's
- Patch 2 makes PqMsg an enum. This ensures that the problem will not
appear again in the future and also gives us a bit more type-safety.
- Patch 3 rearranges the order of the functions in pqformat.{c,h} a
bit to make the code easier to read.

[1]: https://www.postgresql.org/message-id/flat/1df84daa-7d0d-e8cc-4762-85523e45e5e7%40mailbox.org

-- 
Best regards,
Aleksander Alekseev

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Compress ReorderBuffer spill files using LZ4
Next
From: Aleksander Alekseev
Date:
Subject: Re: temp table on commit delete rows performance issue