From ab88e3dba28bdd14a13af1d76cc84b857fba82d0 Mon Sep 17 00:00:00 2001 From: Bram Gruneir Date: Fri, 26 Oct 2018 12:06:32 -0400 Subject: [PATCH] sql: error wording and type fix Reword and convert a generic error to a pgerror. Release note: None --- pkg/sql/pg_catalog.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/sql/pg_catalog.go b/pkg/sql/pg_catalog.go index cd3356de37cc..141ebe351cbc 100644 --- a/pkg/sql/pg_catalog.go +++ b/pkg/sql/pg_catalog.go @@ -31,6 +31,7 @@ import ( "bytes" "github.com/cockroachdb/cockroach/pkg/security" + "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/sem/builtins" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sem/types" @@ -682,9 +683,8 @@ CREATE TABLE pg_catalog.pg_constraint ( confmatchtype = fkMatchTypeSimple columnIDs := con.Index.ColumnIDs if int(con.FK.SharedPrefixLen) > len(columnIDs) { - return errors.Errorf( - "For foreign key %q's shared prefix len (%d) is greater than the number of columns "+ - "in the index (%d). This might be an indication of inconsistency.", + return pgerror.NewAssertionErrorf( + "foreign key %q's SharedPrefixLen (%d) is greater than the columns in the index (%d)", con.FK.Name, con.FK.SharedPrefixLen, int32(len(columnIDs)),