I noticed a couple more opportunities to use the PqMsg_* macros.

-- 
nathan
>From 7cdd91579734de76fcd52cabdb49671ee309ddf6 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <[email protected]>
Date: Mon, 25 Aug 2025 09:53:48 -0500
Subject: [PATCH v1 1/1] Use PqMsg_* macros in fe-protocol3.c.

---
 src/include/libpq/protocol.h        |  1 +
 src/interfaces/libpq/fe-protocol3.c | 12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/include/libpq/protocol.h b/src/include/libpq/protocol.h
index c64e628628d..7bf90053bcb 100644
--- a/src/include/libpq/protocol.h
+++ b/src/include/libpq/protocol.h
@@ -66,6 +66,7 @@
 
 
 /* These are the codes sent by parallel workers to leader processes. */
+
 #define PqMsg_Progress              'P'
 
 
diff --git a/src/interfaces/libpq/fe-protocol3.c 
b/src/interfaces/libpq/fe-protocol3.c
index 43ad672abce..da7a8db68c8 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -2262,7 +2262,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
                 */
                switch (id)
                {
-                       case 'V':                       /* function result */
+                       case PqMsg_FunctionCallResponse:
                                if (pqGetInt(actual_result_len, 4, conn))
                                        continue;
                                if (*actual_result_len != -1)
@@ -2283,22 +2283,22 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
                                /* correctly finished function result message */
                                status = PGRES_COMMAND_OK;
                                break;
-                       case 'E':                       /* error return */
+                       case PqMsg_ErrorResponse:
                                if (pqGetErrorNotice3(conn, true))
                                        continue;
                                status = PGRES_FATAL_ERROR;
                                break;
-                       case 'A':                       /* notify message */
+                       case PqMsg_NotificationResponse:
                                /* handle notify and go back to processing 
return values */
                                if (getNotify(conn))
                                        continue;
                                break;
-                       case 'N':                       /* notice */
+                       case PqMsg_NoticeResponse:
                                /* handle notice and go back to processing 
return values */
                                if (pqGetErrorNotice3(conn, false))
                                        continue;
                                break;
-                       case 'Z':                       /* backend is ready for 
new query */
+                       case PqMsg_ReadyForQuery:
                                if (getReadyForQuery(conn))
                                        continue;
 
@@ -2330,7 +2330,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
                                }
                                /* and we're out */
                                return pqPrepareAsyncResult(conn);
-                       case 'S':                       /* parameter status */
+                       case PqMsg_ParameterStatus:
                                if (getParameterStatus(conn))
                                        continue;
                                break;
-- 
2.39.5 (Apple Git-154)

Reply via email to