diff --git a/pkg/sql/logictest/testdata/logic_test/prepare b/pkg/sql/logictest/testdata/logic_test/prepare index 001b7bacae0c..beec4863c18e 100644 --- a/pkg/sql/logictest/testdata/logic_test/prepare +++ b/pkg/sql/logictest/testdata/logic_test/prepare @@ -1301,7 +1301,7 @@ PREPARE a1 AS SELECT * FROM t3 FOR UPDATE statement ok BEGIN READ ONLY -statement error cannot execute FOR UPDATE in a read-only transaction +statement error cannot execute SELECT FOR UPDATE in a read-only transaction EXECUTE a1 statement ok @@ -1316,7 +1316,7 @@ PREPARE a1 AS SELECT * FROM t3 FOR NO KEY UPDATE statement ok BEGIN READ ONLY -statement error cannot execute FOR NO KEY UPDATE in a read-only transaction +statement error cannot execute SELECT FOR NO KEY UPDATE in a read-only transaction EXECUTE a1 statement ok @@ -1331,7 +1331,7 @@ PREPARE a1 AS SELECT * FROM t3 FOR SHARE statement ok BEGIN READ ONLY -statement error cannot execute FOR SHARE in a read-only transaction +statement error cannot execute SELECT FOR SHARE in a read-only transaction EXECUTE a1 statement ok @@ -1346,7 +1346,7 @@ PREPARE a1 AS SELECT * FROM t3 FOR KEY SHARE statement ok BEGIN READ ONLY -statement error cannot execute FOR KEY SHARE in a read-only transaction +statement error cannot execute SELECT FOR KEY SHARE in a read-only transaction EXECUTE a1 statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/select_for_update b/pkg/sql/logictest/testdata/logic_test/select_for_update index b7b8b705e5d8..79c549d292d5 100644 --- a/pkg/sql/logictest/testdata/logic_test/select_for_update +++ b/pkg/sql/logictest/testdata/logic_test/select_for_update @@ -409,7 +409,7 @@ user root statement ok BEGIN READ ONLY -statement error cannot execute FOR UPDATE in a read-only transaction +statement error cannot execute SELECT FOR UPDATE in a read-only transaction SELECT * FROM t FOR UPDATE statement ok @@ -418,7 +418,7 @@ ROLLBACK statement ok BEGIN READ ONLY -statement error cannot execute FOR NO KEY UPDATE in a read-only transaction +statement error cannot execute SELECT FOR NO KEY UPDATE in a read-only transaction SELECT * FROM t FOR NO KEY UPDATE statement ok @@ -428,7 +428,7 @@ statement ok BEGIN READ ONLY skipif config local-mixed-22.2-23.1 -statement error cannot execute FOR SHARE in a read-only transaction +statement error cannot execute SELECT FOR SHARE in a read-only transaction SELECT * FROM t FOR SHARE statement ok @@ -438,7 +438,7 @@ statement ok BEGIN READ ONLY skipif config local-mixed-22.2-23.1 -statement error cannot execute FOR KEY SHARE in a read-only transaction +statement error cannot execute SELECT FOR KEY SHARE in a read-only transaction SELECT * FROM t FOR KEY SHARE statement ok diff --git a/pkg/sql/opt/exec/execbuilder/relational.go b/pkg/sql/opt/exec/execbuilder/relational.go index 610119c413bb..97b2492bb4cc 100644 --- a/pkg/sql/opt/exec/execbuilder/relational.go +++ b/pkg/sql/opt/exec/execbuilder/relational.go @@ -2911,7 +2911,7 @@ func (b *Builder) buildLocking(locking opt.Locking) (opt.Locking, error) { // Raise error if row-level locking is part of a read-only transaction. if b.evalCtx.TxnReadOnly { return opt.Locking{}, pgerror.Newf(pgcode.ReadOnlySQLTransaction, - "cannot execute %s in a read-only transaction", locking.Strength.String(), + "cannot execute SELECT %s in a read-only transaction", locking.Strength.String(), ) } if locking.Form == tree.LockPredicate {