Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2b99ce1

Browse files
committed
Tweak a bit the new TAP tests of REINDEX DATABASE/SYSTEM
This renames the relation storing the relfilenode state into somethingmore generic as it also stores data for non-toast relations. Arestriction on the number of digits used for the OID number whenfiltering toast relation names is removed, while on it, as there is noneed for it.Reported-by: Justin PryzbyReviewed-by: Justin PryzbyDiscussion:https://postgr.es/m/20220719022652.GE12702@telsasoft.com
1 parent171ab95 commit2b99ce1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
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 TABLEtoast_relfilenodes (parent regclass, indname regclass, relfilenode oid);'
43+
'CREATE TABLEindex_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 INTOtoast_relfilenodes$fetch_toast_relfilenodes;"
62-
."INSERT INTOtoast_relfilenodes$fetch_index_relfilenodes;";
61+
"INSERT INTOindex_relfilenodes$fetch_toast_relfilenodes;"
62+
."INSERT INTOindex_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-
FROMtoast_relfilenodes b
74+
FROMindex_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-
"TRUNCATEtoast_relfilenodes;$save_relfilenodes");
94+
"TRUNCATEindex_relfilenodes;$save_relfilenodes");
9595
$node->issues_sql_like(
9696
['reindexdb','-s','postgres' ],
9797
qr/statement: REINDEX SYSTEM postgres;/,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp