Hi,

I have tested this with a few databases, and I think 23502 is the most
standard SQLState. Test case: create table test(id int, data varchar(255)
not null); insert into test values(1, null). Result:

jdbc:h2:mem:
  SQLState: 23502
  ErrorCode: 23502
  Message: NULL not allowed for column "DATA"

jdbc:hsqldb:/tmp/db/test
  SQLState: 23502
  ErrorCode: -10
  Message: integrity constraint violation: NOT NULL check constraint;
SYS_CT_10028 table: TEST column: DATA

jdbc:derby:/tmp/db/test2;create=true
  SQLState: 23502
  ErrorCode: 30000
  Message: Column 'DATA'  cannot accept a NULL value.

jdbc:mysql://localhost:3306/test
  SQLState: 23000
  ErrorCode: 1048
  Message: Column 'data' cannot be null

jdbc:postgresql:test
  SQLState: 23502
  ErrorCode: 0
  Message: ERROR: null value in column "data" violates not-null constraint

Regards,
Thomas


On Tue, May 21, 2013 at 12:51 AM, Gili <[email protected]> wrote:
>
> Hi,
>
> I believe H2 should throw SQLState 2201C instead of 23502 when users
attempt to insert NULL into a column that disallows it.
>
> H2's documentation can be found here:
http://www.h2database.com/javadoc/org/h2/constant/ErrorCode.html#c23502
> SQLState 2201C is defined as "null row not permitted in table" by the SQL
2008 standard as found in 5CD-02-Foundation-2006-01.pdf in:
http://en.wikipedia.org/wiki/SQL#cite_note-39
>
> Gili
>
> --
> You received this message because you are subscribed to the Google Groups
"H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to