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

Dag H. Wanvik commented on DERBY-991:
-------------------------------------

This issue calls for a more correct error message, as far as I can see. Primary 
key(i) implies unique(i), so the unique specification is, at best, redundant. 
It could also be a sign of a user error and if so, swallowing it silently may 
not be a good thing. In my view, Hibernate should not generate this code..
What do other database than MySQL do in this case, I wonder?


> Defining the same  primary key twice on a table actually attempts to create 
> two constraints.
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-991
>                 URL: https://issues.apache.org/jira/browse/DERBY-991
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>            Reporter: Daniel John Debrunner
>            Priority: Minor
>         Attachments: w.sql
>
>
> Defining the same  primary key twice on a table actually attempts to create 
> two constraints.
> ij> create table t ( i int, b int,  primary key (i,b), primary key (i,b));
> ERROR 42Z93: Constraints 'SQL060215062628851' and 'SQL060215062628850' have 
> the
> same set of columns, which is not allowed.
> ij> create table t ( i int primary key primary key primary key);
> ERROR 42Z93: Constraints 'SQL060214082337951' and 'SQL060214082337950' have 
> the
> same set of columns, which is not allowed.
> Other combinations of two primary keys (that I could think of) return the 
> correct error.
> ij> create table t ( i int, b int,  primary key (i,b), primary key (b));
> ERROR 42X90: More than one primary key constraint specified for table 'T'.
> ij> create table t ( i int primary key, b int primary key);
> ERROR 42X90: More than one primary key constraint specified for table 'T'.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to