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: v1-0001-Always-pass-PgMsg_-to-pg_beginmessage-_reuse.patch
Description: Binary data

Attachment: v1-0002-Intoruce-PgMsg-enum.patch
Description: Binary data

Attachment: v1-0003-Rearrange-the-order-of-functions-in-pgformat.-c-h.patch
Description: Binary data

Reply via email to