Fix bug in replication/snapshot isolation mode.
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Sep 2024 00:54:56 +0000 (09:54 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Sep 2024 01:00:55 +0000 (10:00 +0900)
When INSERT command is received, pgpool automatically issues table
LOCK command to the target table but it forgot to send the command to
other than main nodes. This only happened in extended query mode.
This commit fixes the bug.

Discussion: GitHub issue #69.
https://github.com/pgpool/pgpool2/issues/69
Backpatch-through: v4.1

src/protocol/pool_process_query.c

index d2c1a9c084830c13fac98094d419b2e7cd4241aa..114db90788998b0c3102704b173e11996272e781 100644 (file)
@@ -2794,7 +2794,7 @@ insert_lock(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend, char *qu
                                        per_node_statement_log(backend, i, qbuf);
                                        if (pool_get_session_context(true) && pool_is_doing_extended_query_message())
                                        {
-                                               do_query(MAIN(backend), qbuf, &result, MAJOR(backend));
+                                               do_query(CONNECTION(backend, i), qbuf, &result, MAJOR(backend));
                                                if (result)
                                                        free_select_result(result);
                                        }