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] Closed: (DERBY-882) Increasing size of varchar type using ALTER TABLE can implicitly change the column from NOT NULL to NULLable.
Date Mon, 30 Jan 2006 20:37:35 GMT
     [ http://issues.apache.org/jira/browse/DERBY-882?page=all ]
     
Satheesh Bandaram closed DERBY-882:
-----------------------------------


Verified fix addresses the problem being reported on both 10.1 and 10.2 builds.

> 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.2.0.0, 10.1.2.2
>  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