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 Fri, 09 Jan 2009 09:12:59 GMT

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

Knut Anders Hatlen commented on DERBY-4006:
-------------------------------------------

I played some more with the patch and didn't find any problems. I don't know if it warrants
an extra test case, but I found another manifestation of the bug fixed by the patch. Without
the patch, this does not raise an error:

ij> alter table t add column y int generated always as (-1);
0 rows inserted/updated/deleted
ij> alter table t alter column y default null;
0 rows inserted/updated/deleted

Even though it doesn't raise an error, it doesn't actually change the default value. Specifying
a non-null default would raise an error even without the patch.

With the patch, it does raise an error:

ij> alter table t add column y int generated always as (-1);
0 rows inserted/updated/deleted
ij> alter table t alter column y default null;
ERROR 42XA7: 'Y' is a generated column. You cannot change its default value.

(Strangely though, if the column is GENERATED ALWAYS AS IDENTITY, you are allowed to change
the default value. But that's not related to this issue.)

> 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: 10.2.2.0, 10.3.1.4, 10.3.2.1, 10.3.3.0, 10.4.1.3, 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: patchWithTest.diff, quickCodePatch.diff
>
>
> 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.


Mime
View raw message