1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3 #[error("invalid SQL identifier: {0:?}")]
4 InvalidIdentifier(String),
5 #[error("invalid SQL type name: {0:?}")]
6 InvalidSqlType(String),
7 #[error("query requires at least one selected expression")]
8 EmptySelection,
9 #[error("scalar subquery requires exactly one selected expression, found {0}")]
10 InvalidScalarSubquery(usize),
11 #[error("duplicate common table expression name: {0:?}")]
12 DuplicateCte(String),
13 #[error(
14 "set-operation operands with CTE, ordering, limit, offset, or row locking are not supported"
15 )]
16 UnsupportedSetOperand,
17 #[error("select row locking cannot be combined with set operations")]
18 UnsupportedLockingSetOperation,
19 #[error("select lock target {0:?} is not present in the query source or joins")]
20 InvalidLockTarget(String),
21 #[error("invalid window frame boundaries")]
22 InvalidWindowFrame,
23 #[error("raw SQL query cannot be empty")]
24 EmptyRawQuery,
25 #[error("insert query requires at least one value")]
26 EmptyInsert,
27 #[error("insert row {row} has columns that differ from the first row")]
28 InconsistentInsertColumns { row: usize },
29 #[error("insert row {row} assigns column {column:?} more than once")]
30 DuplicateInsertColumn { row: usize, column: String },
31 #[error("conflict target requires at least one column")]
32 EmptyConflictTarget,
33 #[error("conflict target requires an action")]
34 MissingConflictAction,
35 #[error("conflict update requires at least one assignment")]
36 EmptyConflictUpdate,
37 #[error("conflict clause assigns column {0:?} more than once")]
38 DuplicateConflictColumn(String),
39 #[error("conflict clause contains a column from table {actual:?}, expected {expected:?}")]
40 WrongConflictTable { expected: String, actual: String },
41 #[error("update query requires at least one assignment")]
42 EmptyUpdate,
43 #[error("insert values belong to table {actual:?}, expected {expected:?}")]
44 WrongInsertTable { expected: String, actual: String },
45 #[error("update value belongs to table {actual:?}, expected {expected:?}")]
46 WrongUpdateTable { expected: String, actual: String },
47 #[error("query compilation failed: {0}")]
48 Compilation(String),
49}
50
51pub type Result<T, E = Error> = std::result::Result<T, E>;