Skip to content

Commit 1318678

Browse files
committed
drt: fix issue with add-index
add-index operation fails today when a table is passed as an argument. The issue was because the select from pg_catalog.pg_attribute requires you to set the database by "USE DB_NAME". In case a table is not specified, the same gets executed in "PickRandomTable" function. Epic: None Release: None
1 parent b3688c4 commit 1318678

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/cmd/roachtest/operations/add_index.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func runAddIndex(
5454
rng, _ := randutil.NewPseudoRand()
5555
dbName := helpers.PickRandomDB(ctx, o, conn, helpers.SystemDBs)
5656
tableName := helpers.PickRandomTable(ctx, o, conn, dbName)
57+
if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE %s", dbName)); err != nil {
58+
o.Fatal(err)
59+
}
60+
5761
rows, err := conn.QueryContext(ctx, fmt.Sprintf(
5862
`
5963
SELECT

0 commit comments

Comments
 (0)