db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-789) Usability issue: "Constraints have the same set of columns"
Date Wed, 03 Mar 2010 09:17:27 GMT

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

Knut Anders Hatlen commented on DERBY-789:
------------------------------------------

PostgreSQL 8.4 "forgets" the redundant constraint. That is, for the following statement

  CREATE TABLE T (X INT, CONSTRAINT PK PRIMARY KEY (X), CONSTRAINT U UNIQUE (X))

it creates the primary key constraint PK, but not the unique constraint U. Attempts to drop
the constraint U fail, because there is no such constraint. Dropping the constraint PK is
enough to allow you to insert duplicates.

MySQL 5.1 does not forget the redundant constraint. So there you are not able to insert duplicates
unless you drop *both* the primary key constraint and the unique constraint.

Derby with the PrimaryImpliesUnique patch behaves the same way as MySQL.

> Usability issue: "Constraints have the  same  set of columns"
> -------------------------------------------------------------
>
>                 Key: DERBY-789
>                 URL: https://issues.apache.org/jira/browse/DERBY-789
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Øystein Grøvlen
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: PrimaryImpliesUnique.diff
>
>
> Legolas Woodland reported on derby-user that derby return errors like :
> org.apache.derby.client.am.SqlException:                    Constraints
> 'SQL060103004635123'  and 'SQL060103004635121'  have the  same  set of
> columns, which is not allowed.
> He got this when creating a table like this:
> create  table  WEBSITES (USERID  integer  not  null unique,  WEBSITEID
> bigint  not  null unique,  DOMAINNAME  varchar(255)  not null  unique,
> DESCRIPTION  varchar(255),  PPVIEW   double,  PPCLICK  double,  PPWEEK
> double, totalClick bigint,  totalView bigint, active smallint, primary
> key (WEBSITEID));
> Omitting the unique specifier made things work. 
> I think this is a usability issue.   At least, one should not present names to the user,
that has been generated internally.  Instead, it would be helpful if the names of the columns
involved was mentioned. I see two ways to solve this:
> 1. Return error that says that  duplicate contraints on the following columns are not
allowed.
> 2. Allow this and use same index for both constraints.  (I guess dropping constraints
will be more complicated in this case since one will have to check if other constraints are
using the same index.)

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


Mime
View raw message