aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-07-21 11:00:48 +0900
committerMichael Paquier <michael@paquier.xyz>2022-07-21 11:00:48 +0900
commit2b99ce10c2bc2b901cf2fe04f844f3983943bf9f (patch)
treeeaa73f555ca4e1163ed7577e65a3c9845ca65453
parent171ab95f64493f30dccf34bb1cafaa7b4957cd4e (diff)
downloadpostgresql-2b99ce10c2bc2b901cf2fe04f844f3983943bf9f.tar.gz
postgresql-2b99ce10c2bc2b901cf2fe04f844f3983943bf9f.zip
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
-rw-r--r--src/bin/scripts/t/090_reindexdb.pl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl
index 864707ff926..b5fff5a9cf1 100644
--- a/src/bin/scripts/t/090_reindexdb.pl
+++ b/src/bin/scripts/t/090_reindexdb.pl
@@ -40,7 +40,7 @@ my $toast_index = $node->safe_psql('postgres',
# REINDEX operations. A set of relfilenodes is saved from the catalogs
# and then compared with pg_class.
$node->safe_psql('postgres',
- 'CREATE TABLE toast_relfilenodes (parent regclass, indname regclass, relfilenode oid);'
+ 'CREATE TABLE index_relfilenodes (parent regclass, indname regclass, relfilenode oid);'
);
# Save the relfilenode of a set of toast indexes, one from the catalog
# pg_constraint and one from the test table.
@@ -58,8 +58,8 @@ my $fetch_index_relfilenodes = qq{SELECT i.indrelid, a.oid, a.relfilenode
JOIN pg_index i ON (i.indexrelid = a.oid)
WHERE a.relname IN ('pg_constraint_oid_index', 'test1x')};
my $save_relfilenodes =
- "INSERT INTO toast_relfilenodes $fetch_toast_relfilenodes;"
- . "INSERT INTO toast_relfilenodes $fetch_index_relfilenodes;";
+ "INSERT INTO index_relfilenodes $fetch_toast_relfilenodes;"
+ . "INSERT INTO index_relfilenodes $fetch_index_relfilenodes;";
# Query to compare a set of relfilenodes saved with the contents of pg_class.
# Note that this does not join using OIDs, as CONCURRENTLY would change them
@@ -68,10 +68,10 @@ my $save_relfilenodes =
# based on the name is enough to ensure a fixed output, where the name of the
# parent table is included to provide more context.
my $compare_relfilenodes = qq(SELECT b.parent::regclass,
- regexp_replace(b.indname::text, '(pg_toast.pg_toast_)\\d{4,5}(_index)', '\\1<oid>\\2'),
+ regexp_replace(b.indname::text, '(pg_toast.pg_toast_)\\d+(_index)', '\\1<oid>\\2'),
CASE WHEN a.relfilenode = b.relfilenode THEN 'relfilenode is unchanged'
ELSE 'relfilenode has changed' END
- FROM toast_relfilenodes b
+ FROM index_relfilenodes b
JOIN pg_class a ON b.indname::text = a.oid::regclass::text
ORDER BY b.parent::text, b.indname::text);
@@ -91,7 +91,7 @@ test1|test1x|relfilenode has changed),
# Re-save and run the second one.
$node->safe_psql('postgres',
- "TRUNCATE toast_relfilenodes; $save_relfilenodes");
+ "TRUNCATE index_relfilenodes; $save_relfilenodes");
$node->issues_sql_like(
[ 'reindexdb', '-s', 'postgres' ],
qr/statement: REINDEX SYSTEM postgres;/,