agora inbox for pgpool-committers@postgresql.org  
help / color / mirror / Atom feed
pgpool: Fix do_query to send sync rather than flush.
6+ messages / 1 participants
[nested] [flat]

* pgpool: Fix do_query to send sync rather than flush.
@ 2026-08-02 06:34  Tatsuo Ishii <ishii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tatsuo Ishii @ 2026-08-02 06:34 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Fix do_query to send sync rather than flush.

When in extended query mode and no explicit transaction has started
(i.e. implicit transaction), do_query issues a flush message after
execute message. But this does not close the implicit transaction and
"DISCARD ALL" in reset_query_list failed with:

 "DISCARD ALL cannot run inside a transaction block"

This could happen when query cache is enabled. After an execute and
sync are issued, pgpool generates internal query in extended query
mode using do_query:

SELECT oid FROM pg_catalog.pg_database WHERE datname = 'test'

Since do_query never issued a sync for this query, the implicit
transaction opened by do_query never closed and raised the error.

To fix the issue, send a sync message, rather than a flush message.
Sync will close the unamed portal in an implicit transaction. But to
run an unnamed portal, we need to issue bind message and re-create a
unnamed portal anyway.

Note: the author created the patch for fixing "idle in transaction"
left in pg_stat_activity, but I failed to reproduce the
issue. However, since I found the patch solves the issue above, I
decided to commit the patch anyway.

Author: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/25939319-d77c-4df9-9e65-dfb1637ccd33%40cloud.gatewaynet.com
Backpatch-through: v4.3

Branch
------
V4_3_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=1e6eb4e5bb3a2208a88dac8df0ad437fd17f8...

Modified Files
--------------
src/protocol/pool_process_query.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Fix do_query to send sync rather than flush.
@ 2026-08-02 06:34  Tatsuo Ishii <ishii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tatsuo Ishii @ 2026-08-02 06:34 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Fix do_query to send sync rather than flush.

When in extended query mode and no explicit transaction has started
(i.e. implicit transaction), do_query issues a flush message after
execute message. But this does not close the implicit transaction and
"DISCARD ALL" in reset_query_list failed with:

 "DISCARD ALL cannot run inside a transaction block"

This could happen when query cache is enabled. After an execute and
sync are issued, pgpool generates internal query in extended query
mode using do_query:

SELECT oid FROM pg_catalog.pg_database WHERE datname = 'test'

Since do_query never issued a sync for this query, the implicit
transaction opened by do_query never closed and raised the error.

To fix the issue, send a sync message, rather than a flush message.
Sync will close the unamed portal in an implicit transaction. But to
run an unnamed portal, we need to issue bind message and re-create a
unnamed portal anyway.

Note: the author created the patch for fixing "idle in transaction"
left in pg_stat_activity, but I failed to reproduce the
issue. However, since I found the patch solves the issue above, I
decided to commit the patch anyway.

Author: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/25939319-d77c-4df9-9e65-dfb1637ccd33%40cloud.gatewaynet.com
Backpatch-through: v4.3

Branch
------
V4_4_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=c1eb10dc1df76483b3b793e012d4c40447267...

Modified Files
--------------
src/protocol/pool_process_query.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Fix do_query to send sync rather than flush.
@ 2026-08-02 06:34  Tatsuo Ishii <ishii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tatsuo Ishii @ 2026-08-02 06:34 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Fix do_query to send sync rather than flush.

When in extended query mode and no explicit transaction has started
(i.e. implicit transaction), do_query issues a flush message after
execute message. But this does not close the implicit transaction and
"DISCARD ALL" in reset_query_list failed with:

 "DISCARD ALL cannot run inside a transaction block"

This could happen when query cache is enabled. After an execute and
sync are issued, pgpool generates internal query in extended query
mode using do_query:

SELECT oid FROM pg_catalog.pg_database WHERE datname = 'test'

Since do_query never issued a sync for this query, the implicit
transaction opened by do_query never closed and raised the error.

To fix the issue, send a sync message, rather than a flush message.
Sync will close the unamed portal in an implicit transaction. But to
run an unnamed portal, we need to issue bind message and re-create a
unnamed portal anyway.

Note: the author created the patch for fixing "idle in transaction"
left in pg_stat_activity, but I failed to reproduce the
issue. However, since I found the patch solves the issue above, I
decided to commit the patch anyway.

Author: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/25939319-d77c-4df9-9e65-dfb1637ccd33%40cloud.gatewaynet.com
Backpatch-through: v4.3

Branch
------
V4_5_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=a6ac3ea54cc6c7d4b251f843154589a5d6dce...

Modified Files
--------------
src/protocol/pool_process_query.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Fix do_query to send sync rather than flush.
@ 2026-08-02 06:34  Tatsuo Ishii <ishii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tatsuo Ishii @ 2026-08-02 06:34 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Fix do_query to send sync rather than flush.

When in extended query mode and no explicit transaction has started
(i.e. implicit transaction), do_query issues a flush message after
execute message. But this does not close the implicit transaction and
"DISCARD ALL" in reset_query_list failed with:

 "DISCARD ALL cannot run inside a transaction block"

This could happen when query cache is enabled. After an execute and
sync are issued, pgpool generates internal query in extended query
mode using do_query:

SELECT oid FROM pg_catalog.pg_database WHERE datname = 'test'

Since do_query never issued a sync for this query, the implicit
transaction opened by do_query never closed and raised the error.

To fix the issue, send a sync message, rather than a flush message.
Sync will close the unamed portal in an implicit transaction. But to
run an unnamed portal, we need to issue bind message and re-create a
unnamed portal anyway.

Note: the author created the patch for fixing "idle in transaction"
left in pg_stat_activity, but I failed to reproduce the
issue. However, since I found the patch solves the issue above, I
decided to commit the patch anyway.

Author: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/25939319-d77c-4df9-9e65-dfb1637ccd33%40cloud.gatewaynet.com
Backpatch-through: v4.3

Branch
------
V4_6_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=22965306db058fb5d786d0dfcfe45e8b2f4f2...

Modified Files
--------------
src/protocol/pool_process_query.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Fix do_query to send sync rather than flush.
@ 2026-08-02 06:34  Tatsuo Ishii <ishii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tatsuo Ishii @ 2026-08-02 06:34 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Fix do_query to send sync rather than flush.

When in extended query mode and no explicit transaction has started
(i.e. implicit transaction), do_query issues a flush message after
execute message. But this does not close the implicit transaction and
"DISCARD ALL" in reset_query_list failed with:

 "DISCARD ALL cannot run inside a transaction block"

This could happen when query cache is enabled. After an execute and
sync are issued, pgpool generates internal query in extended query
mode using do_query:

SELECT oid FROM pg_catalog.pg_database WHERE datname = 'test'

Since do_query never issued a sync for this query, the implicit
transaction opened by do_query never closed and raised the error.

To fix the issue, send a sync message, rather than a flush message.
Sync will close the unamed portal in an implicit transaction. But to
run an unnamed portal, we need to issue bind message and re-create a
unnamed portal anyway.

Note: the author created the patch for fixing "idle in transaction"
left in pg_stat_activity, but I failed to reproduce the
issue. However, since I found the patch solves the issue above, I
decided to commit the patch anyway.

Author: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/25939319-d77c-4df9-9e65-dfb1637ccd33%40cloud.gatewaynet.com
Backpatch-through: v4.3

Branch
------
V4_7_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=bc3689a2d62f2083699b86feb267e90296913...

Modified Files
--------------
src/protocol/pool_process_query.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgpool: Fix do_query to send sync rather than flush.
@ 2026-08-02 06:34  Tatsuo Ishii <ishii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tatsuo Ishii @ 2026-08-02 06:34 UTC (permalink / raw)
  To: pgpool-committers@lists.postgresql.org

Fix do_query to send sync rather than flush.

When in extended query mode and no explicit transaction has started
(i.e. implicit transaction), do_query issues a flush message after
execute message. But this does not close the implicit transaction and
"DISCARD ALL" in reset_query_list failed with:

 "DISCARD ALL cannot run inside a transaction block"

This could happen when query cache is enabled. After an execute and
sync are issued, pgpool generates internal query in extended query
mode using do_query:

SELECT oid FROM pg_catalog.pg_database WHERE datname = 'test'

Since do_query never issued a sync for this query, the implicit
transaction opened by do_query never closed and raised the error.

To fix the issue, send a sync message, rather than a flush message.
Sync will close the unamed portal in an implicit transaction. But to
run an unnamed portal, we need to issue bind message and re-create a
unnamed portal anyway.

Also 039.log_backend_messages regression test is adjusted.

Note: the author created the patch for fixing "idle in transaction"
left in pg_stat_activity, but I failed to reproduce the
issue. However, since I found the patch solves the issue above, I
decided to commit the patch anyway.

Author: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/25939319-d77c-4df9-9e65-dfb1637ccd33%40cloud.gatewaynet.com
Backpatch-through: v4.3

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=e4a3a0c13e4b5e1a015aca3db238b21b88e73...

Modified Files
--------------
src/protocol/pool_process_query.c                  | 26 +++++++++-------------
.../tests/039.log_backend_messages/expected.s      |  1 -
2 files changed, 10 insertions(+), 17 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-08-02 06:34 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-02 06:34 pgpool: Fix do_query to send sync rather than flush. Tatsuo Ishii <ishii@postgresql.org>
2026-08-02 06:34 pgpool: Fix do_query to send sync rather than flush. Tatsuo Ishii <ishii@postgresql.org>
2026-08-02 06:34 pgpool: Fix do_query to send sync rather than flush. Tatsuo Ishii <ishii@postgresql.org>
2026-08-02 06:34 pgpool: Fix do_query to send sync rather than flush. Tatsuo Ishii <ishii@postgresql.org>
2026-08-02 06:34 pgpool: Fix do_query to send sync rather than flush. Tatsuo Ishii <ishii@postgresql.org>
2026-08-02 06:34 pgpool: Fix do_query to send sync rather than flush. Tatsuo Ishii <ishii@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox