This modifies the behaviour of Derby and hence needs documentation. How
are the documentation changes tracked? Are committers expected to file
another Jira documentation item? Just wondering...
Documentation like these need to be changed:
http://incubator.apache.org/derby/manuals/reference/sqlj32.html#HDRSII-SQLJ-13590
Satheesh
Jeremy Boynes (JIRA) wrote:
[ 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).
|