[
https://issues.apache.org/jira/browse/DERBY-4006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662086#action_12662086
]
Knut Anders Hatlen commented on DERBY-4006:
-------------------------------------------
The check for (defaultNode == null) in ModifyColumnNode was supposed to mean
"no default value was specified". Ignoring for a moment that we don't currently
have syntax for it in ALTER TABLE, a default value in a ModifyColumnNode could
also be a generation clause, in which case the instance variable defaultNode is
also null. So I'm wondering if the new check for (defaultNode == null &&
!defaultNULLExplicitlySpecified) still doesn't express exactly what we want to
check (although I'm convinced that it fixes the bug and does not cause any
problems with the currently accepted syntax for ALTER TABLE).
Do you think it would make sense to instead have a boolean called
keepCurrentDefault that we initialized in ColumnDefinitionNode.init() like
this? (note the difference between the local variable defaultNode being null
and the instance variable defaultNode being null)
keepCurrentDefault = (defaultNode == null);
Then the check in ModifyColumnNode would simply be "if
(keepCurrentDefaultValue) ...". This way we check that "no default is
associated with this ColumnDefinitionNode" rather than "no DefaultNode or
UntypedNullConstantNode is associated with this ModifyColumnNode". Don't know
if this makes any sense at all, though, but I thought I'd raise the 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: quickCodePatch.diff
>
>
> Reported on derby-user.
> http://mail-archives.apache.org/mod_mbox/db-derby-user/200901.mbox/%[email protected]%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.