[
https://issues.apache.org/jira/browse/IGNITE-5620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16143658#comment-16143658
]
Alexander Paschenko commented on IGNITE-5620:
---------------------------------------------
Per {{SQLSTATE}} spec
(https://en.wikibooks.org/wiki/Structured_Query_Language/SQLSTATE), it seems
like we can support following standard classes of errors:
{{07}} - dynamic SQL error (for invalid # of params, maybe smth else)
{{08}} - connection exception (for underlying H2 conn problems)
{{0A}} - feature not supported (unsupported clauses and modifiers)
{{0D}} - invalid target type specification (for illegal operations in {{CREATE
INDEX}}/{{ALTER TABLE}} contexts)
{{22}} - data exception (null keys/values, etc)
{{23}} - integrity constraint violation (for duplicate keys in {{INSERT}} and
forthcoming per column constraints)
{{3F}} - invalid schema name
{{42}} - syntax error (general parsing errors)
Also it's evident that many RDBMSs define their own error classes, let alone
custom errors in predefined classes, so for Ignite specific stuff as well as
some common things like missing table or invalid column name we probably will
have to do the same (either in new classes or as extension to existing ones).
> Meaningful error codes and types of exceptions for SQL operations
> ------------------------------------------------------------------
>
> Key: IGNITE-5620
> URL: https://issues.apache.org/jira/browse/IGNITE-5620
> Project: Ignite
> Issue Type: Task
> Affects Versions: 2.0
> Reporter: Denis Magda
> Assignee: Alexander Paschenko
> Fix For: 2.2
>
>
> Presently, SQL engine throws a generic type of exception with custom text in
> case of an operation failure. In result, Ignite ODBC driver returns a similar
> error code (2000) for different kind of failures.
> For example, error code 2000 is returned for the following
> {code}
> Duplicate key during INSERT [key=CorpcontactcountKey [idHash=1412656257,
> hash=2004096461, mdn=919200000000]]
> {code}
> {code}
> Failed to parse query: INSERT INTO "DG".Corpcontactcount
> (mdn,contactcount,lastupdatetime)
> values(?,?,?,?)
> {code}
> {code}
> Wrong value has been set [typeName=Pocsubscrinfo, fieldName=vocoderid,
> fieldType=short, assignedValueType=byte] Error Code: 2000
> {code}
> The following has to be done:
> * Create unique types of exceptions for Java whenever applicable.
> * Add {{errorCode}} parameter and method to a generic SQL exception.
> * ODBC and JDBC drivers have to return unique codes based on the exception
> code or type.
> * All the codes have to be documented on readme.io.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)