aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2024-08-16 13:23:18 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2024-08-16 13:23:18 -0400
commitb8b3f861fbd7ff40055225ec48cec97df925ff04 (patch)
tree789bdecb4f5b0c775bd282e1a3c6d89d383d7396 /src/interfaces/libpq/fe-connect.c
parent6be39d77a70df52d5a0f2eb414ef9901ccf17e5a (diff)
downloadpostgresql-b8b3f861fbd7ff40055225ec48cec97df925ff04.tar.gz
postgresql-b8b3f861fbd7ff40055225ec48cec97df925ff04.zip
libpq: Trace all messages received from the server
Not all messages that libpq received from the server would be sent through our message tracing logic. This commit tries to fix that by introducing a new function pqParseDone which make it harder to forget about doing so. The messages that we now newly send through our tracing logic are: - CopyData (received by COPY TO STDOUT) - Authentication requests - NegotiateProtocolVersion - Some ErrorResponse messages during connection startup - ReadyForQuery when received after a FunctionCall message Author: Jelte Fennema-Nio <postgres@jeltef.nl> Discussion: https://postgr.es/m/CAGECzQSoPHtZ4xe0raJ6FYSEiPPS+YWXBhOGo+Y1YecLgknF3g@mail.gmail.com
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 246055df960..ab308a0580f 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -3797,7 +3797,7 @@ keep_going: /* We will come back to here until there is
return PGRES_POLLING_READING;
}
/* OK, we read the message; mark data consumed */
- conn->inStart = conn->inCursor;
+ pqParseDone(conn, conn->inCursor);
/*
* Before 7.2, the postmaster didn't always end its
@@ -3847,7 +3847,7 @@ keep_going: /* We will come back to here until there is
goto error_return;
}
/* OK, we read the message; mark data consumed */
- conn->inStart = conn->inCursor;
+ pqParseDone(conn, conn->inCursor);
/*
* If error is "cannot connect now", try the next host if
@@ -3876,7 +3876,7 @@ keep_going: /* We will come back to here until there is
goto error_return;
}
/* OK, we read the message; mark data consumed */
- conn->inStart = conn->inCursor;
+ pqParseDone(conn, conn->inCursor);
goto error_return;
}
@@ -3901,7 +3901,11 @@ keep_going: /* We will come back to here until there is
*/
res = pg_fe_sendauth(areq, msgLength, conn);
- /* OK, we have processed the message; mark data consumed */
+ /*
+ * OK, we have processed the message; mark data consumed. We
+ * don't call pqParseDone here because we already traced this
+ * message inside pg_fe_sendauth.
+ */
conn->inStart = conn->inCursor;
if (res != STATUS_OK)