From f4b54e1ed9853ab9aff524494866823f951b1e7f Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 22 Aug 2023 19:16:12 -0700 Subject: Introduce macros for protocol characters. This commit introduces descriptively-named macros for the identifiers used in wire protocol messages. These new macros are placed in a new header file so that they can be easily used by third-party code. Author: Dave Cramer Reviewed-by: Alvaro Herrera, Tatsuo Ishii, Peter Smith, Robert Haas, Tom Lane, Peter Eisentraut, Michael Paquier Discussion: https://postgr.es/m/CADK3HHKbBmK-PKf1bPNFoMC%2BoBt%2BpD9PH8h5nvmBQskEHm-Ehw%40mail.gmail.com --- src/backend/access/common/printsimple.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/backend/access/common/printsimple.c') diff --git a/src/backend/access/common/printsimple.c b/src/backend/access/common/printsimple.c index ef818228acb..675b744db20 100644 --- a/src/backend/access/common/printsimple.c +++ b/src/backend/access/common/printsimple.c @@ -20,6 +20,7 @@ #include "access/printsimple.h" #include "catalog/pg_type.h" +#include "libpq/protocol.h" #include "libpq/pqformat.h" #include "utils/builtins.h" @@ -32,7 +33,7 @@ printsimple_startup(DestReceiver *self, int operation, TupleDesc tupdesc) StringInfoData buf; int i; - pq_beginmessage(&buf, 'T'); /* RowDescription */ + pq_beginmessage(&buf, PqMsg_RowDescription); pq_sendint16(&buf, tupdesc->natts); for (i = 0; i < tupdesc->natts; ++i) @@ -65,7 +66,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self) slot_getallattrs(slot); /* Prepare and send message */ - pq_beginmessage(&buf, 'D'); + pq_beginmessage(&buf, PqMsg_DataRow); pq_sendint16(&buf, tupdesc->natts); for (i = 0; i < tupdesc->natts; ++i) -- cgit v1.2.3