0001-fix-BUG-17663-Connect-to-the-database-through-jdbc-c.patch

text/plain

Patch

Format: format-patch
Series: patch 0001
Subject: fix BUG #17663: Connect to the database through jdbc, call the stored procedure containing the rollback statement, the database triggers an assertion, and the database is in recovery mode
File+
contrib/pg_stat_statements/pg_stat_statements.c 4 2
From 4d02406b92339c561aa3b5deca96ca875473655a Mon Sep 17 00:00:00 2001
From: oracle <oracle@localhost.localdomain>
Date: Tue, 1 Nov 2022 20:14:14 +0800
Subject: [PATCH] fix BUG #17663: Connect to the database through jdbc, call
 the stored procedure containing the rollback statement, the database triggers
 an assertion, and the database is in recovery mode

---
 contrib/pg_stat_statements/pg_stat_statements.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c
index 0beb56a..3330f35 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.c
+++ b/contrib/pg_stat_statements/pg_stat_statements.c
@@ -1083,6 +1083,8 @@ pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
 {
 	Node	   *parsetree = pstmt->utilityStmt;
 	uint64		saved_queryId = pstmt->queryId;
+	int	   stmt_location = pstmt->stmt_location;
+	int	   stmt_len = pstmt->stmt_len;
 
 	/*
 	 * Force utility statements to get queryId zero.  We do this even in cases
@@ -1172,8 +1174,8 @@ pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
 
 		pgss_store(queryString,
 				   saved_queryId,
-				   pstmt->stmt_location,
-				   pstmt->stmt_len,
+				   stmt_location,
+				   stmt_len,
 				   PGSS_EXEC,
 				   INSTR_TIME_GET_MILLISEC(duration),
 				   rows,
-- 
1.8.3.1