Monday, March 28, 2011

apache derby constraints

Apache derby's log messages on constraint violation aren't very useful. E.g.,

The check constraint 'SQL123456789012' was violated while performing an INSERT or UPDATE on table ...

To find which constraint that is:

SELECT
s1.checkdefinition
FROM
sys.syschecks s1,
sys.sysconstraints s2,
WHERE
s1.constraintid=s2.constraintid AND
s2.constraintname='SQL123456789012';

No comments: