summaryrefslogtreecommitdiff
path: root/src/backend/utils/error/elog.c
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2023-08-22 19:16:12 -0700
committerNathan Bossart <nathan@postgresql.org>2023-08-22 19:16:12 -0700
commitf4b54e1ed9853ab9aff524494866823f951b1e7f (patch)
treed828a0aceba5a1e74372170b58c97bae56eeefa3 /src/backend/utils/error/elog.c
parent711479115836b2180f50c00bbf0773220848a7f5 (diff)
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
Diffstat (limited to 'src/backend/utils/error/elog.c')
-rw-r--r--src/backend/utils/error/elog.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 5898100acb6..8e1f3e85211 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -3465,7 +3465,10 @@ send_message_to_frontend(ErrorData *edata)
char tbuf[12];
/* 'N' (Notice) is for nonfatal conditions, 'E' is for errors */
- pq_beginmessage(&msgbuf, (edata->elevel < ERROR) ? 'N' : 'E');
+ if (edata->elevel < ERROR)
+ pq_beginmessage(&msgbuf, PqMsg_NoticeResponse);
+ else
+ pq_beginmessage(&msgbuf, PqMsg_ErrorResponse);
sev = error_severity(edata->elevel);
pq_sendbyte(&msgbuf, PG_DIAG_SEVERITY);