@@ -1481,23 +1481,21 @@ DECLARE
14811481BEGIN
14821482 -- we don't want to wait forever; loop will exit after 30 seconds
14831483 FOR i IN 1 .. 300 LOOP
1484- SELECT (pg_stat_get_tuples_hot_updated('brin_hot'::regclass::oid) > 0) INTO updated;
1485- EXIT WHEN updated;
1484+ -- SELECT (pg_stat_get_tuples_hot_updated('brin_hot'::regclass::oid) > 0) INTO updated;
1485+ updated := (pg_stat_get_tuples_hot_updated('brin_hot'::regclass::oid) > 0);
1486+ -- EXIT WHEN updated;
1487+ if updated then
1488+ exit;
1489+ end if;
14861490
14871491 -- wait a little
14881492 PERFORM pg_sleep_for('100 milliseconds');
14891493 -- reset stats snapshot so we can test again
14901494 PERFORM pg_stat_clear_snapshot();
14911495 END LOOP;
1492- -- report time waited in postmaster log (where it won't change test output)
1493- RAISE log 'wait_for_hot_stats delayed % seconds',
1494- EXTRACT(epoch FROM clock_timestamp() - start_time);
14951496END
1496- $$ LANGUAGE plpgsql ;
1497+ $$ LANGUAGE plisql ;
14971498/
1498- ERROR: syntax error at or near "FROM"
1499- LINE 18: EXTRACT(epoch FROM clock_timestamp() - start_time);
1500- ^
15011499UPDATE brin_hot SET val = -3 WHERE id = 42;
15021500-- We can't just call wait_for_hot_stats() at this point, because we only
15031501-- transmit stats when the session goes idle, and we probably didn't
@@ -1507,10 +1505,11 @@ UPDATE brin_hot SET val = -3 WHERE id = 42;
15071505-- then send its stats before dying.
15081506\c -
15091507SELECT wait_for_hot_stats();
1510- ERROR: function wait_for_hot_stats() does not exist
1511- LINE 1: SELECT wait_for_hot_stats();
1512- ^
1513- HINT: No function matches the given name and argument types. You might need to add explicit type casts.
1508+ wait_for_hot_stats
1509+ --------------------
1510+
1511+ (1 row)
1512+
15141513SELECT pg_stat_get_tuples_hot_updated('brin_hot'::regclass::oid);
15151514 pg_stat_get_tuples_hot_updated
15161515--------------------------------
@@ -1519,7 +1518,6 @@ SELECT pg_stat_get_tuples_hot_updated('brin_hot'::regclass::oid);
15191518
15201519DROP TABLE brin_hot;
15211520DROP FUNCTION wait_for_hot_stats();
1522- ERROR: function wait_for_hot_stats() does not exist
15231521-- Test handling of index predicates - updating attributes in precicates
15241522-- should not block HOT when summarizing indexes are involved. We update
15251523-- a row that was not indexed due to the index predicate, and becomes
0 commit comments