Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2b99ce1

Browse files
committed
Tweak a bit the new TAP tests of REINDEX DATABASE/SYSTEM
This renames the relation storing the relfilenode state into something more generic as it also stores data for non-toast relations. A restriction on the number of digits used for the OID number when filtering toast relation names is removed, while on it, as there is no need for it. Reported-by: Justin Pryzby Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/20220719022652.GE12702@telsasoft.com
1 parent 171ab95 commit 2b99ce1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bin/scripts/t/090_reindexdb.pl

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# REINDEX operations. A set of relfilenodes is saved from the catalogs
4141
# and then compared with pg_class.
4242
$node->safe_psql('postgres',
43-
'CREATE TABLE toast_relfilenodes (parent regclass, indname regclass, relfilenode oid);'
43+
'CREATE TABLE index_relfilenodes (parent regclass, indname regclass, relfilenode oid);'
4444
);
4545
# Save the relfilenode of a set of toast indexes, one from the catalog
4646
# pg_constraint and one from the test table.
@@ -58,8 +58,8 @@
5858
JOIN pg_index i ON (i.indexrelid = a.oid)
5959
WHERE a.relname IN ('pg_constraint_oid_index', 'test1x')};
6060
my $save_relfilenodes =
61-
"INSERT INTO toast_relfilenodes $fetch_toast_relfilenodes;"
62-
. "INSERT INTO toast_relfilenodes $fetch_index_relfilenodes;";
61+
"INSERT INTO index_relfilenodes $fetch_toast_relfilenodes;"
62+
. "INSERT INTO index_relfilenodes $fetch_index_relfilenodes;";
6363

6464
# Query to compare a set of relfilenodes saved with the contents of pg_class.
6565
# Note that this does not join using OIDs, as CONCURRENTLY would change them
@@ -68,10 +68,10 @@
6868
# based on the name is enough to ensure a fixed output, where the name of the
6969
# parent table is included to provide more context.
7070
my $compare_relfilenodes = qq(SELECT b.parent::regclass,
71-
regexp_replace(b.indname::text, '(pg_toast.pg_toast_)\\d{4,5}(_index)', '\\1<oid>\\2'),
71+
regexp_replace(b.indname::text, '(pg_toast.pg_toast_)\\d+(_index)', '\\1<oid>\\2'),
7272
CASE WHEN a.relfilenode = b.relfilenode THEN 'relfilenode is unchanged'
7373
ELSE 'relfilenode has changed' END
74-
FROM toast_relfilenodes b
74+
FROM index_relfilenodes b
7575
JOIN pg_class a ON b.indname::text = a.oid::regclass::text
7676
ORDER BY b.parent::text, b.indname::text);
7777

@@ -91,7 +91,7 @@
9191

9292
# Re-save and run the second one.
9393
$node->safe_psql('postgres',
94-
"TRUNCATE toast_relfilenodes; $save_relfilenodes");
94+
"TRUNCATE index_relfilenodes; $save_relfilenodes");
9595
$node->issues_sql_like(
9696
[ 'reindexdb', '-s', 'postgres' ],
9797
qr/statement: REINDEX SYSTEM postgres;/,

0 commit comments

Comments
 (0)