class
CQL::Postgres::ServerError
- CQL::Postgres::ServerError
- CQL::Postgres::Error
- CQL::Error
- Exception
- Reference
- Object
Overview
An ErrorResponse from the server. The server's own wording
(#server_message) and #detail can quote bound values (a unique violation
names the duplicate key, "invalid input syntax" quotes the offending text,
a $1::regclass cast quotes its argument). message therefore uses the
server's wording only for SQLSTATE classes known to be value-free and a
fixed title otherwise; the raw fields stay available for callers who accept
that risk.
Direct Known Subclasses
- CQL::Postgres::IntegrityViolation
- CQL::Postgres::InvalidAuthorization
- CQL::Postgres::QueryCanceled
- CQL::Postgres::SyntaxOrAccessError
- CQL::Postgres::TransactionRollback
Defined in:
postgres/errors.cr:70postgres/errors.cr:175
Constant Summary
-
BY_CLASS =
{"23" => IntegrityViolation, "28" => InvalidAuthorization, "40" => TransactionRollback, "42" => SyntaxOrAccessError} of String => ServerError.class -
BY_SQLSTATE =
{"23505" => UniqueViolation, "23503" => ForeignKeyViolation, "23502" => NotNullViolation, "23514" => CheckViolation, "40001" => SerializationFailure, "40P01" => DeadlockDetected, "42P01" => UndefinedTable, "42703" => UndefinedColumn, "57014" => QueryCanceled} of String => ServerError.class -
TITLES =
{"42P01" => "undefined table", "42703" => "undefined column", "42601" => "syntax error", "42501" => "insufficient privilege", "22P02" => "invalid text representation", "40001" => "serialization failure", "40P01" => "deadlock detected", "40" => "transaction rollback", "42P05" => "prepared statement already exists (behind a transaction-mode pooler? set statement_cache_size=0)", "26000" => "prepared statement does not exist (behind a transaction-mode pooler? set statement_cache_size=0)", "22" => "data exception", "42" => "syntax error or access rule violation", "P0" => "PL/pgSQL error"} -
VALUE_FREE_CLASSES =
{"08", "0A", "23", "25", "28", "3D", "53", "54", "55", "57", "58"}
Constructors
-
.from(fields : Hash(Char, String)) : ServerError
Subclass per SQLSTATE where one exists, else per SQLSTATE class.
- .new(fields : Hash(Char, String))
Instance Method Summary
- #column : String | Nil
- #constraint : String | Nil
- #detail : String | Nil
- #hint : String | Nil
- #position : Int32 | Nil
- #routine : String | Nil
- #schema : String | Nil
- #server_message : String
- #severity : String
- #sqlstate : String
-
#stale_plan? : Bool
The server's cached plan became invalid after a schema change; preparing the statement again fixes it.
- #table : String | Nil
Constructor Detail
Subclass per SQLSTATE where one exists, else per SQLSTATE class.
Instance Method Detail
The server's cached plan became invalid after a schema change; preparing the statement again fixes it. PostgreSQL names the routine; CockroachDB only sends the same message text.