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-4006) ALTER COLUMN ... WITH DEFAULT NULL does not change the default
Date Thu, 08 Jan 2009 13:02:59 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661961#action_12661961

Knut Anders Hatlen commented on DERBY-4006:

It looks like the behaviour changed after this commit:

r474502 | bpendleton | 2006-11-13 21:36:51 +0100 (Mon, 13 Nov 2006) | 13 lines

DERBY-1495: Error modifying an identity column after altering the column
DERBY-1645: ALTER TABLE SET INCREMENT turns off "Generated By Default"

This patch changes ModifyColumnNode.bindAndValidateDefault so that it
detects the case(s) where the user is altering aspects of an identity column,
and ensures that the other aspects of that identity column are preserved and
not lost. The crucial issue is that if the column is Generated By Default,
then the DefaultInfoImpl column in the SYSCOLUMNS table needs to get
retained when the user uses ALTER TABLE to change either the start value
or the increment value; otherwise the behavior effectively switches from
Generated By Default to Generated Always.


> ALTER COLUMN ... WITH DEFAULT NULL does not change the default
> --------------------------------------------------------------
>                 Key: DERBY-4006
>                 URL: https://issues.apache.org/jira/browse/DERBY-4006
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:,,,,,
>            Reporter: Knut Anders Hatlen
> Reported on derby-user.
> http://mail-archives.apache.org/mod_mbox/db-derby-user/200901.mbox/%3c21349727.post@talk.nabble.com%3e
> ij> create table t (x varchar(5) default 'abc');
> 0 rows inserted/updated/deleted
> ij> alter table t alter column x with default null;
> 0 rows inserted/updated/deleted
> ij> insert into t values default;
> 1 row inserted/updated/deleted
> ij> select * from t;
> X    
> -----
> abc  
> 1 row selected

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

View raw message