Hi,

On Wed, Nov 04, 2026 at 07:08:54PM -0600, Sami Imseih wrote:
> PFA a mandatory rebase

Thanks for the updated patch!

+       xact_boundary = !IsTransactionOrTransactionBlock();

I looks like that procedure commits are missed.

For example, in session 1:

CREATE TABLE flush_test (id integer);

CREATE PROCEDURE flush_probe()
LANGUAGE plpgsql AS $$
BEGIN
    INSERT INTO flush_test VALUES (1);
    PERFORM pg_stat_force_next_flush();
    COMMIT;

    INSERT INTO flush_test VALUES (2);
    PERFORM pg_stat_force_next_flush();
    PERFORM pg_sleep(20);
END
$$;

CALL flush_probe();

While it sleeps, session 2 reports one row:

SELECT count(*) FROM flush_test;
count
-------
   1

but no inserts:

SELECT n_tup_ins FROM pg_stat_user_tables
WHERE relname = 'flush_test';
 n_tup_ins
-----------
         0

I would have expected n_tup_ins = 1.

I wonder if the committed transaction’s counters should be flushed before the
procedure starts the next transaction?

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com


Reply via email to