You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Bernt M. Johnsen (JIRA)" <de...@db.apache.org> on 2005/03/03 22:52:52 UTC

[jira] Created: (DERBY-158) PRIMARY KEY does not imply NOT NULL

PRIMARY KEY does not imply NOT NULL
-----------------------------------

         Key: DERBY-158
         URL: http://issues.apache.org/jira/browse/DERBY-158
     Project: Derby
        Type: Bug
  Components: SQL  
    Reporter: Bernt M. Johnsen
    Priority: Minor


PRIMARY KEY does not imply NOT NULL. Derby issues error message:

ij> create table tab (i integer primary key);
ERROR 42831: 'I' cannot be a column of a primary key or unique key because it can contain null values.

This is neither compliant with SQL-92 nor with SQL-99 (Feature E141-08, I think).


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Updated: (DERBY-158) PRIMARY KEY does not imply NOT NULL

Posted by Jeremy Boynes <jb...@apache.org>.
Mamta Satoor wrote:
> Hi Jeremy,
> 
> I was wondering if you added test cases for alter table for this bug? 
> 

I didn't - I did review the existing ones but didn't add anything as I 
thought they covered it (the behaviour for alter table did not change).

--
Jeremy

Re: [jira] Updated: (DERBY-158) PRIMARY KEY does not imply NOT NULL

Posted by Mamta Satoor <ms...@gmail.com>.
Hi Jeremy,

I was wondering if you added test cases for alter table for this bug? 

thanks,
Mamta


On Sat, 5 Mar 2005 05:45:47 +0100 (CET), Jeremy Boynes (JIRA)
<de...@db.apache.org> wrote:
>     [ http://issues.apache.org/jira/browse/DERBY-158?page=history ]
> 
> Jeremy Boynes updated DERBY-158:
> --------------------------------
> 
>    Attachment: derby-158-1.patch
> 
> Patch to TableElementList that implicitly adds NOT NULL to columns included in a PRIMARY KEY constraint contained in a CREATE TABLE statement. However, it does not allow UNIQUE to be added in CREATE TABLE if any of the columns are NULL; similarly UNIQUE or PRIMARY KEY constraints cannot be added with ALTER TABLE if any of the columns are nullable.
> 
> I am posting this first for review as a couple of tests still need to be updated.
> 
> > PRIMARY KEY does not imply NOT NULL
> > -----------------------------------
> >
> >          Key: DERBY-158
> >          URL: http://issues.apache.org/jira/browse/DERBY-158
> >      Project: Derby
> >         Type: Bug
> >   Components: SQL
> >     Reporter: Bernt M. Johnsen
> >     Assignee: Jeremy Boynes
> >     Priority: Minor
> >  Attachments: derby-158-1.patch
> >
> > PRIMARY KEY does not imply NOT NULL. Derby issues error message:
> > ij> create table tab (i integer primary key);
> > ERROR 42831: 'I' cannot be a column of a primary key or unique key because it can contain null values.
> > This is neither compliant with SQL-92 nor with SQL-99 (Feature E141-08, I think).
> 
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>   http://issues.apache.org/jira/secure/Administrators.jspa
> -
> If you want more information on JIRA, or have a bug to report see:
>   http://www.atlassian.com/software/jira
> 
>

[jira] Resolved: (DERBY-158) PRIMARY KEY does not imply NOT NULL

Posted by "Jeremy Boynes (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-158?page=history ]
     
Jeremy Boynes resolved DERBY-158:
---------------------------------

     Resolution: Fixed
    Fix Version: 10.1.0.0

URL: http://svn.apache.org/viewcvs?view=rev&rev=156570
Log:
Fix for DERBY-158 PRIMARY KEY does not imply NOT NULL
Columns specified in a PRIMARY KEY constraint in CREATE TABLE 
are implicitly set to NOT NULL per the SQL spec. 

If a PRIMARY KEY constraint is added using ALTER TABLE then all
columns must also be NOT NULL. Similarly, columns
specified in a UNIQUE constraint must still be explictly NOT NULL.

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/nulls.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/primarykey.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/nulls.sql
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/primarykey.sql

> PRIMARY KEY does not imply NOT NULL
> -----------------------------------
>
>          Key: DERBY-158
>          URL: http://issues.apache.org/jira/browse/DERBY-158
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Bernt M. Johnsen
>     Assignee: Jeremy Boynes
>     Priority: Minor
>      Fix For: 10.1.0.0
>  Attachments: derby-158-1.patch, derby-158-2.patch
>
> PRIMARY KEY does not imply NOT NULL. Derby issues error message:
> ij> create table tab (i integer primary key);
> ERROR 42831: 'I' cannot be a column of a primary key or unique key because it can contain null values.
> This is neither compliant with SQL-92 nor with SQL-99 (Feature E141-08, I think).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-158) PRIMARY KEY does not imply NOT NULL

Posted by "Jeremy Boynes (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-158?page=history ]

Jeremy Boynes reassigned DERBY-158:
-----------------------------------

    Assign To: Jeremy Boynes

> PRIMARY KEY does not imply NOT NULL
> -----------------------------------
>
>          Key: DERBY-158
>          URL: http://issues.apache.org/jira/browse/DERBY-158
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Bernt M. Johnsen
>     Assignee: Jeremy Boynes
>     Priority: Minor

>
> PRIMARY KEY does not imply NOT NULL. Derby issues error message:
> ij> create table tab (i integer primary key);
> ERROR 42831: 'I' cannot be a column of a primary key or unique key because it can contain null values.
> This is neither compliant with SQL-92 nor with SQL-99 (Feature E141-08, I think).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-158) PRIMARY KEY does not imply NOT NULL

Posted by "Jeremy Boynes (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-158?page=history ]

Jeremy Boynes updated DERBY-158:
--------------------------------

    Attachment: derby-158-1.patch

Patch to TableElementList that implicitly adds NOT NULL to columns included in a PRIMARY KEY constraint contained in a CREATE TABLE statement. However, it does not allow UNIQUE to be added in CREATE TABLE if any of the columns are NULL; similarly UNIQUE or PRIMARY KEY constraints cannot be added with ALTER TABLE if any of the columns are nullable.

I am posting this first for review as a couple of tests still need to be updated.

> PRIMARY KEY does not imply NOT NULL
> -----------------------------------
>
>          Key: DERBY-158
>          URL: http://issues.apache.org/jira/browse/DERBY-158
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Bernt M. Johnsen
>     Assignee: Jeremy Boynes
>     Priority: Minor
>  Attachments: derby-158-1.patch
>
> PRIMARY KEY does not imply NOT NULL. Derby issues error message:
> ij> create table tab (i integer primary key);
> ERROR 42831: 'I' cannot be a column of a primary key or unique key because it can contain null values.
> This is neither compliant with SQL-92 nor with SQL-99 (Feature E141-08, I think).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-158) PRIMARY KEY does not imply NOT NULL

Posted by "Bernt M. Johnsen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-158?page=all ]
     
Bernt M. Johnsen closed DERBY-158:
----------------------------------


> PRIMARY KEY does not imply NOT NULL
> -----------------------------------
>
>          Key: DERBY-158
>          URL: http://issues.apache.org/jira/browse/DERBY-158
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Bernt M. Johnsen
>     Assignee: Jeremy Boynes
>     Priority: Minor
>      Fix For: 10.1.0.0
>  Attachments: derby-158-1.patch, derby-158-2.patch
>
> PRIMARY KEY does not imply NOT NULL. Derby issues error message:
> ij> create table tab (i integer primary key);
> ERROR 42831: 'I' cannot be a column of a primary key or unique key because it can contain null values.
> This is neither compliant with SQL-92 nor with SQL-99 (Feature E141-08, I think).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira