[ 
https://issues.apache.org/jira/browse/DERBY-6773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14698433#comment-14698433
 ] 

Bryan Pendleton commented on DERBY-6773:
----------------------------------------

It seems that LANG_NULL_INTO_NON_NULL is the only integrity violation
for which we don't have tablename+constraintname; the others listed above
all have both arguments.

However, another annoyance is that they aren't consistent: sometimes the
table name is the first argument, and the constraint name is the second
argument, while sometimes the constraint name is the first argument, while
the table name is the second.

For LANG_FK_VIOLATION, constraint name comes first, then table name.
For LANG_DUPLICATE_KEY_CONSTRAINT, constraint name first, then table name.

But for LANG_CHECK_CONSTRAINT_VIOLATED, table name comes first, then constraint 
name.

I believe this means that SQLExceptionFactory (in both client and server) must
have a more complex decision table about deciding when it can construct the
new DerbySQLIntegrityConstraintViolationException, and, if it can, about which
argument is the table name, and which the constraint name.

And of course we'll need to have tests covering all these cases.


> Derby throws plain SQLIntegrityConstraintViolationException
> -----------------------------------------------------------
>
>                 Key: DERBY-6773
>                 URL: https://issues.apache.org/jira/browse/DERBY-6773
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.10.2.0
>         Environment: Windows 7 x86_64, Java 1.6.0.45
>            Reporter: Jochen Wiedmann
>            Assignee: Abhinav Gupta
>            Priority: Minor
>         Attachments: CallSuper.diff, DERBY6733Repro.java, SamePackage.diff, 
> SharedException.diff, addToTestSuite.diff, ant -verbose build all.txt, 
> generateOnClientDoesntWork.diff, subPart1.diff, subPart2.diff, switchArgs.diff
>
>
> If a unique constraint is violated by an insert statement, then Derby throws 
> an SQLIntegrityConstraintViolationException. The error message contains, in 
> particular, the constraint name and the table name.
> To distinguish between cases with various constraints, Derby should instead 
> throw a subclass of SQLIntegrityConstraintViolationException, with methods 
> like getConstraintName(), and getTableName().
> See also https://hibernate.atlassian.net/browse/HHH-9516.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to