Skip to content

Commit 14583a1

Browse files
committed
roachtest/pg_regress: adjust runner to remove table IDs
I've seen a particular unimplemented error result in the diffs churn because it includes table IDs which can change between run, for some reason. Let's just remove the table ID from the error. Release note: None
1 parent d1bfdaa commit 14583a1

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

pkg/cmd/roachtest/testdata/pg_regress/alter_table.diffs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/alter_table.out -
16301630
-ERROR: column "test" is in a primary key
16311631
+ERROR: column "test" is in a primary index
16321632
alter table atacc1 drop constraint "atacc1_pkey";
1633-
+ERROR: relation "atacc1" (1984): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
1633+
+ERROR: relation "atacc1": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
16341634
+HINT: You have attempted to use a feature that is not yet implemented.
16351635
+See: https://go.crdb.dev/issue-v/48026/_version_
16361636
alter table atacc1 alter column test drop not null;
@@ -5404,7 +5404,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/alter_table.out -
54045404
DELETE FROM old_system_table WHERE othercol = 'somedata';
54055405
TRUNCATE old_system_table;
54065406
ALTER TABLE old_system_table DROP CONSTRAINT new_system_table_pkey;
5407-
+ERROR: relation "old_system_table" (2082): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
5407+
+ERROR: relation "old_system_table": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
54085408
+HINT: You have attempted to use a feature that is not yet implemented.
54095409
+See: https://go.crdb.dev/issue-v/48026/_version_
54105410
ALTER TABLE old_system_table DROP COLUMN othercol;

pkg/cmd/roachtest/testdata/pg_regress/create_view.diffs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/create_view.out -
119119
-ERROR: cannot drop constraint view_base_table_pkey on table view_base_table because other objects depend on it
120120
-DETAIL: view key_dependent_view depends on constraint view_base_table_pkey on table view_base_table
121121
-HINT: Use DROP ... CASCADE to drop the dependent objects too.
122-
+ERROR: relation "view_base_table" (325): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
122+
+ERROR: relation "view_base_table": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
123123
+HINT: You have attempted to use a feature that is not yet implemented.
124124
+See: https://go.crdb.dev/issue-v/48026/_version_
125125
CREATE VIEW key_dependent_view_no_cols AS

pkg/cmd/roachtest/testdata/pg_regress/functional_deps.diffs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/functional_deps.o
112112
-ERROR: cannot drop constraint articles_pkey on table articles because other objects depend on it
113113
-DETAIL: view fdv1 depends on constraint articles_pkey on table articles
114114
-HINT: Use DROP ... CASCADE to drop the dependent objects too.
115-
+ERROR: relation "articles" (1613): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
115+
+ERROR: relation "articles": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
116116
+HINT: You have attempted to use a feature that is not yet implemented.
117117
+See: https://go.crdb.dev/issue-v/48026/_version_
118118
DROP VIEW fdv1;
@@ -125,14 +125,14 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/functional_deps.o
125125
-ERROR: cannot drop constraint articles_pkey on table articles because other objects depend on it
126126
-DETAIL: view fdv2 depends on constraint articles_pkey on table articles
127127
-HINT: Use DROP ... CASCADE to drop the dependent objects too.
128-
+ERROR: relation "articles" (1613): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
128+
+ERROR: relation "articles": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
129129
+HINT: You have attempted to use a feature that is not yet implemented.
130130
+See: https://go.crdb.dev/issue-v/48026/_version_
131131
ALTER TABLE articles_in_category DROP CONSTRAINT articles_in_category_pkey RESTRICT; --fail
132132
-ERROR: cannot drop constraint articles_in_category_pkey on table articles_in_category because other objects depend on it
133133
-DETAIL: view fdv2 depends on constraint articles_in_category_pkey on table articles_in_category
134134
-HINT: Use DROP ... CASCADE to drop the dependent objects too.
135-
+ERROR: relation "articles_in_category" (1614): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
135+
+ERROR: relation "articles_in_category": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
136136
+HINT: You have attempted to use a feature that is not yet implemented.
137137
+See: https://go.crdb.dev/issue-v/48026/_version_
138138
DROP VIEW fdv2;
@@ -145,7 +145,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/functional_deps.o
145145
-ERROR: cannot drop constraint articles_pkey on table articles because other objects depend on it
146146
-DETAIL: view fdv3 depends on constraint articles_pkey on table articles
147147
-HINT: Use DROP ... CASCADE to drop the dependent objects too.
148-
+ERROR: relation "articles" (1613): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
148+
+ERROR: relation "articles": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
149149
+HINT: You have attempted to use a feature that is not yet implemented.
150150
+See: https://go.crdb.dev/issue-v/48026/_version_
151151
DROP VIEW fdv3;
@@ -155,7 +155,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/functional_deps.o
155155
-ERROR: cannot drop constraint articles_pkey on table articles because other objects depend on it
156156
-DETAIL: view fdv4 depends on constraint articles_pkey on table articles
157157
-HINT: Use DROP ... CASCADE to drop the dependent objects too.
158-
+ERROR: relation "articles" (1613): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
158+
+ERROR: relation "articles": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
159159
+HINT: You have attempted to use a feature that is not yet implemented.
160160
+See: https://go.crdb.dev/issue-v/48026/_version_
161161
DROP VIEW fdv4;
@@ -165,7 +165,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/functional_deps.o
165165
(0 rows)
166166

167167
ALTER TABLE articles DROP CONSTRAINT articles_pkey RESTRICT;
168-
+ERROR: relation "articles" (1613): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
168+
+ERROR: relation "articles": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
169169
+HINT: You have attempted to use a feature that is not yet implemented.
170170
+See: https://go.crdb.dev/issue-v/48026/_version_
171171
EXECUTE foo; -- fail

pkg/cmd/roachtest/testdata/pg_regress/merge.diffs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
576576

577577
-- remove constraints
578578
alter table target drop CONSTRAINT target_pkey;
579-
+ERROR: relation "target" (1327): unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
579+
+ERROR: relation "target": unimplemented: primary key dropped without subsequent addition of new primary key in same transaction
580580
+HINT: You have attempted to use a feature that is not yet implemented.
581581
+See: https://go.crdb.dev/issue-v/48026/_version_
582582
alter table target alter column tid drop not null;

pkg/cmd/roachtest/tests/pg_regress.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,16 @@ func runPGRegress(ctx context.Context, t test.Test, c cluster.Cluster) {
442442
if err != nil {
443443
t.L().Printf("Failed to read %s: %s", tmpFilePath, err)
444444
}
445-
issueURI := regexp.MustCompile(`https:\/\/go\.crdb\.dev\/issue-v\/(\d+)\/[^\/|^\s]+`)
445+
issueURI := regexp.MustCompile(`https://go\.crdb\.dev/issue-v/(\d+)/[^/|^\s]+`)
446446
actualB = issueURI.ReplaceAll(actualB, []byte("https://go.crdb.dev/issue-v/$1/_version_"))
447-
docsURI := regexp.MustCompile(`https:\/\/www\.cockroachlabs.com\/docs\/[^\/|^\s]+`)
447+
docsURI := regexp.MustCompile(`https://www\.cockroachlabs.com/docs/[^/|^\s]+`)
448448
actualB = docsURI.ReplaceAll(actualB, []byte("https://www.cockroachlabs.com/docs/_version_"))
449+
450+
// Remove table ID from the unimplemented error for dropping the PK
451+
// without a replacement (to reduce the diff churn).
452+
dropPK := regexp.MustCompile(`(.*ERROR:.*relation.*".*") \(\d+\)(: unimplemented: primary key dropped without subsequent addition of new primary key in same transaction*)`)
453+
actualB = dropPK.ReplaceAll(actualB, []byte("$1$2"))
454+
449455
err = os.WriteFile(diffFilePath, actualB, 0644)
450456
if err != nil {
451457
t.L().Printf("Failed to write %s: %s", diffFilePath, err)

0 commit comments

Comments
 (0)