github.com/dolthub/go-mysql-server@v0.18.0/sql/analyzer/analyzererrors/errors.go (about) 1 // Copyright 2020-2023 Dolthub, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package analyzererrors 16 17 import "gopkg.in/src-d/go-errors.v1" 18 19 var ( 20 // ErrValidationResolved is returned when the plan can not be resolved. 21 ErrValidationResolved = errors.NewKind("plan is not resolved because of node '%T'") 22 // ErrValidationOrderBy is returned when the order by contains aggregation 23 // expressions. 24 ErrValidationOrderBy = errors.NewKind("OrderBy does not support aggregation expressions") 25 // ErrValidationGroupBy is returned when the aggregation expression does not 26 // appear in the grouping columns. 27 ErrValidationGroupBy = errors.NewKind("expression '%v' doesn't appear in the group by expressions") 28 // ErrValidationSchemaSource is returned when there is any column source 29 // that does not match the table name. 30 ErrValidationSchemaSource = errors.NewKind("one or more schema sources are empty") 31 // ErrUnknownIndexColumns is returned when there are columns in the expr 32 // to index that are unknown in the table. 33 ErrUnknownIndexColumns = errors.NewKind("unknown columns to index for table %q: %s") 34 // ErrCaseResultType is returned when one or more of the types of the values in 35 // a case expression don't match. 36 ErrCaseResultType = errors.NewKind( 37 "expecting all case branches to return values of type %s, " + 38 "but found value %q of type %s on %s", 39 ) 40 // ErrIntervalInvalidUse is returned when an interval expression is not 41 // correctly used. 42 ErrIntervalInvalidUse = errors.NewKind( 43 "invalid use of an interval, which can only be used with DATE_ADD, " + 44 "DATE_SUB and +/- operators to subtract from or add to a date", 45 ) 46 // ErrExplodeInvalidUse is returned when an EXPLODE function is used 47 // outside a Project node. 48 ErrExplodeInvalidUse = errors.NewKind( 49 "using EXPLODE is not supported outside a Project node", 50 ) 51 52 // ErrSubqueryFieldIndex is returned when an expression subquery references a field outside the range of the rows it 53 // works on. 54 ErrSubqueryFieldIndex = errors.NewKind( 55 "subquery field index out of range for expression %s: only %d columns available", 56 ) 57 58 // ErrUnionSchemasMatch is returned when both sides of a UNION do not 59 // have the same schema. 60 ErrUnionSchemasMatch = errors.NewKind( 61 "the schema of the left side of union does not match the right side, expected %s to match %s", 62 ) 63 64 // ErrReadOnlyDatabase is returned when a write is attempted to a ReadOnlyDatabse. 65 ErrReadOnlyDatabase = errors.NewKind("Database %s is read-only.") 66 67 // ErrInvalidRowLength is returned when a DDL table spec exceeds the row length limit 68 ErrInvalidRowLength = errors.NewKind("invalid table spec: expected size < %d, found %d") 69 )