03.06.2023 22:00, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 17959
> Logged by: Alexander Lakhin
> Email address: exclusion@gmail.com
> PostgreSQL version: 16beta1
> Operating system: Ubuntu 22.04
> Description:
>
> After some DDL/transactional operations (a reproducer to follow)
> pg_amcheck detects an anomaly:
> btree index "regress001.pg_catalog.pg_depend_reference_index":
> ERROR: heap tuple (13,35) from table "pg_depend" lacks matching index
> tuple within index "pg_depend_reference_index"
The operations that trigger that anomaly are as follows:
my $bsession1 = $node->background_psql('regress001');
$bsession1->query_safe("create temp table t1(a int)");
my $bsession2 = $node->background_psql('regress002');
$bsession2->query_safe("begin transaction");
$bsession2->query_safe("prepare transaction 'pt1'");
$bsession1->quit;
my $bsession3 = $node->background_psql('regress001');
$bsession3->query_safe("create temp table t1(a int)");
$bsession3->query_safe("vacuum t1");
$bsession2->quit;
$bsession3->quit;
A complete TAP test to reproduce the issue is attached.
I put it in src/bin/pg_amcheck/t/, run (on master, e6a254c0d)
PROVE_TESTS=t/099_pdri_error.pl make -s check -C src/bin/pg_amcheck/
and get:
# Failed test 'pg_amcheck after manipulations stdout /(?^:^$)/'
# at t/099_pdri_error.pl line 60.
# 'btree index "regress001.pg_catalog.pg_depend_reference_index":
# ERROR: heap tuple (13,35) from table "pg_depend" lacks matching index tuple within index
"pg_depend_reference_index"
# '
# doesn't match '(?^:^$)'
Best regards,
Alexander