From 5af8ac6513f29f3edb88859cdc8a7f2ea7d45d03 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Tue, 19 Nov 2024 15:07:26 -0800 Subject: [PATCH] sql: match PG error when dropping non-existent trigger Found in pg_regress (which we'll update separately). Release note: None --- pkg/ccl/logictestccl/testdata/logic_test/triggers | 2 +- pkg/sql/sqlerrors/errors.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ccl/logictestccl/testdata/logic_test/triggers b/pkg/ccl/logictestccl/testdata/logic_test/triggers index fe763bfd6c5d..933daab159bb 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/triggers +++ b/pkg/ccl/logictestccl/testdata/logic_test/triggers @@ -737,7 +737,7 @@ statement ok DROP TRIGGER bar ON xy; # Dropping a nonexistent trigger is an error. -statement error pgcode 42704 pq: trigger "foo" of relation "xy" does not exist +statement error pgcode 42704 pq: trigger "foo" for table "xy" does not exist DROP TRIGGER foo ON xy; # The IF EXISTS syntax allows dropping a nonexistent trigger without error. diff --git a/pkg/sql/sqlerrors/errors.go b/pkg/sql/sqlerrors/errors.go index 40fc75076ed2..dee0041a4d9a 100644 --- a/pkg/sql/sqlerrors/errors.go +++ b/pkg/sql/sqlerrors/errors.go @@ -431,7 +431,7 @@ func NewUndefinedConstraintError(constraintName, tableName string) error { // NewUndefinedTriggerError returns a missing constraint error. func NewUndefinedTriggerError(triggerName, tableName string) error { return pgerror.Newf(pgcode.UndefinedObject, - "trigger %q of relation %q does not exist", triggerName, tableName) + "trigger %q for table %q does not exist", triggerName, tableName) } // NewRangeUnavailableError creates an unavailable range error.