[PATCH] Refactor pqformat.{c,h} and protocol.h

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Refactor pqformat.{c,h} and protocol.h
Date: 2024-07-16 13:09:44
Message-ID: CAJ7c6TNTd09AZq8tGaHS3LDyH_CCnpv0oOz2wN1dGe8zekxrdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v1-0001-Always-pass-PgMsg_-to-pg_beginmessage-_reuse.patch application/octet-stream 5.1 KB
v1-0002-Intoruce-PgMsg-enum.patch application/octet-stream 7.1 KB
v1-0003-Rearrange-the-order-of-functions-in-pgformat.-c-h.patch application/octet-stream 3.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2024-07-16 13:20:57 Re: temp table on commit delete rows performance issue
Previous Message Amit Kapila 2024-07-16 12:52:51 Re: Compress ReorderBuffer spill files using LZ4