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 00:54:56 +0000 (09:54 +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 2eb877f9f8dd9115193bc821a1257177ecff7f1f..2aab2b29d64fa678cb390324bd6627a7c8fce8ad 100644 (file)
@@ -2835,7 +2835,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);
                                        }