db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Satheesh Bandaram (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-882) Increasing size of varchar type using ALTER TABLE can implicitly change the column from NOT NULL to NULLable.
Date Sat, 28 Jan 2006 02:23:34 GMT
    [ http://issues.apache.org/jira/browse/DERBY-882?page=comments#action_12364289 ] 

Satheesh Bandaram commented on DERBY-882:
-----------------------------------------

Merged fix from 10.1 branch into trunk.

Sending        java\engine\org\apache\derby\impl\sql\compile\ModifyColumnNode.java
Sending        java\testing\org\apache\derbyTesting\functionTests\master\modifyColumn.out
Sending        java\testing\org\apache\derbyTesting\functionTests\tests\lang\modifyColumn.sql
Transmitting file data ...
Committed revision 373067.

> Increasing size of varchar type using ALTER TABLE can implicitly change the column from
NOT NULL to NULLable.
> -------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-882
>          URL: http://issues.apache.org/jira/browse/DERBY-882
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.1.2.2, 10.2.0.0
>  Environment: generic
>     Reporter: Satheesh Bandaram
>     Assignee: Satheesh Bandaram
>      Fix For: 10.2.0.0, 10.1.3.0

>
> Altering size of a varchar column using ALTER TABLE command can change the column from
not nullable to nullable.
> ij version 10.1
> ij> connect 'jdbc:derby:bdb;create=true';
> ij> create table a (id integer not null, name varchar(20) not null, primary key(name));
> 0 rows inserted/updated/deleted
> ij> insert into a values (1, 'abc');
> 1 row inserted/updated/deleted
> ij> insert into a values (2, null);
> ERROR 23502: Column 'NAME'  cannot accept a NULL value.                     <====
Initially doesn't accept nulls
> ij> alter table a alter name set data type varchar(50);                          
            <==== Change size of varchar column
> 0 rows inserted/updated/deleted
> ij> insert into a values (3, 'hijk');
> 1 row inserted/updated/deleted
> ij> insert into a values (4, null);                                              
                              <==== Now NULLs are accepted
> 1 row inserted/updated/deleted
> ij> select * from a;
> ID         |NAME
> --------------------------------------------------------------
> 1          |abc
> 3          |hijk
> 4          |NULL

-- 
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


Mime
View raw message