Subject RE: [Firebird-Architect] Proposal to add SQLState to Vulcan
Author Claudio Valderrama C.
> -----Original Message-----
> From: Firebird-Architect@yahoogroups.com
> [mailto:Firebird-Architect@yahoogroups.com]On Behalf Of Bill Oliver
> Sent: MiƩrcoles, 31 de Enero de 2007 17:36
>
> This feature will require changes to the message database. Obviously, we
> have to new SQLSTATE information. But there are also a couple of places
> where today's error message is ambiguous, and needs to be un-ambiguated
> (disambiguated?).
>
> Here's one. We have SQLSTATE 22001, "String data, right-truncated" and
> SQLSTATE 22012, "Division by zero". But, we have one Firebird message
> that is printed for both of these case:
>
> SQL> recreate table test (c char(5 ) ) ;
> SQL> insert into test (c) values ('text123') ;
> Statement failed, SQLCODE = -802
> arithmetic exception, numeric overflow, or string truncation
>
> SQL> select (1/0) from rdb$database ;
>
> =====================
> Statement failed, SQLCODE = -802
> arithmetic exception, numeric overflow, or string truncation

Is this really a problem? I mean, it can be solved with the current
functionality. Just append more information at the point where the error is
generated.
if (divisor == 0)
ERR_post(isc_arith_except, 0);
=>
if (divisor == 0)
ERR_post(isc_arith_except,
isc_arg_gds, isc_zero_div, 0);



> Here's a case where we don't generate a specific error, but should. We
> should map error below to SQLSTATE 42S21, "Column already exists."
>
> SQL> create table test (i integer) ;
> SQL> alter table test add i integer ;
> Statement failed, SQLCODE = -607
> unsuccessful metadata update
> -STORE RDB$RELATION_FIELDS failed
> -attempt to store duplicate value (visible to active transactions) in
> unique index "RDB$INDEX_15"

IMHO, this just requires more work in DYN. These messages refer to raw
operations on system tables.

C.