You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Mark P Ashworth <in...@connext.co.za> on 2008/07/25 13:38:30 UTC

Alter TIMESTAMP field default after creation does not work

Good Day,

Derby version: 10.2.2.0

As part of the database data upgrade process I need to do the following so
that the existing rows get a NULL for the column but all new rows will get
the default of the current timestamp.

CREATE TABLE X (
 FIELD INT
)

ALTER TABLE X ADD COLUMN FIELD_DATE TIMESTAMP

ALTER TABLE X ALTER FIELD_DATE DEFAULT CURRENT_TIMESTAMP

Regards,
Mark P Ashworth
-- 
View this message in context: http://www.nabble.com/Alter-TIMESTAMP-field-default-after-creation-does-not-work-tp18650021p18650021.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Alter TIMESTAMP field default after creation does not work

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Mark,

A serious data corruption bug was fixed in the latest release in the 
10.3 series (10.3.3.0) as well as in the current 10.4.1.3 release. The 
earlier releases in the 10.3 series, which had that bug, were removed 
from the download page: http://db.apache.org/derby/derby_downloads.html

In my opinion, 10.3.3.0 is a better release than 10.2.2.0.

Regards,
-Rick

Mark P Ashworth wrote:
> Good Day,
>
> Thank you for the reply.
>
> I am just a bit concerned upgrading because a release in 10.3.x is marked
> with causing database corruption and so far Derby has been relatively
> stable.
>
> Regards,
> Mark P Ashworth
>
>
>
>
>
>
>
>
> Rick Hillegas-2 wrote:
>   
>> Hi Mark,
>>
>> I find that this fails for me too when using the 10.2 series of 
>> releases. However, the experiment succeeds when I use the 10.3 and 10.4 
>> releases.
>>
>> Regards,
>> -Rick
>>
>> Mark P Ashworth wrote:
>>     
>>> Good Day,
>>>
>>> Derby version: 10.2.2.0
>>>
>>> As part of the database data upgrade process I need to do the following
>>> so
>>> that the existing rows get a NULL for the column but all new rows will
>>> get
>>> the default of the current timestamp.
>>>
>>> CREATE TABLE X (
>>>  FIELD INT
>>> )
>>>
>>> ALTER TABLE X ADD COLUMN FIELD_DATE TIMESTAMP
>>>
>>> ALTER TABLE X ALTER FIELD_DATE DEFAULT CURRENT_TIMESTAMP
>>>
>>> Regards,
>>> Mark P Ashworth
>>>   
>>>       
>>
>>     
>
>   


Re: Alter TIMESTAMP field default after creation does not work

Posted by Mark P Ashworth <in...@connext.co.za>.
Good Day,

Thank you for the reply.

I am just a bit concerned upgrading because a release in 10.3.x is marked
with causing database corruption and so far Derby has been relatively
stable.

Regards,
Mark P Ashworth








Rick Hillegas-2 wrote:
> 
> Hi Mark,
> 
> I find that this fails for me too when using the 10.2 series of 
> releases. However, the experiment succeeds when I use the 10.3 and 10.4 
> releases.
> 
> Regards,
> -Rick
> 
> Mark P Ashworth wrote:
>> Good Day,
>>
>> Derby version: 10.2.2.0
>>
>> As part of the database data upgrade process I need to do the following
>> so
>> that the existing rows get a NULL for the column but all new rows will
>> get
>> the default of the current timestamp.
>>
>> CREATE TABLE X (
>>  FIELD INT
>> )
>>
>> ALTER TABLE X ADD COLUMN FIELD_DATE TIMESTAMP
>>
>> ALTER TABLE X ALTER FIELD_DATE DEFAULT CURRENT_TIMESTAMP
>>
>> Regards,
>> Mark P Ashworth
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Alter-TIMESTAMP-field-default-after-creation-does-not-work-tp18650021p18652114.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Alter TIMESTAMP field default after creation does not work

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Mark,

I find that this fails for me too when using the 10.2 series of 
releases. However, the experiment succeeds when I use the 10.3 and 10.4 
releases.

Regards,
-Rick

Mark P Ashworth wrote:
> Good Day,
>
> Derby version: 10.2.2.0
>
> As part of the database data upgrade process I need to do the following so
> that the existing rows get a NULL for the column but all new rows will get
> the default of the current timestamp.
>
> CREATE TABLE X (
>  FIELD INT
> )
>
> ALTER TABLE X ADD COLUMN FIELD_DATE TIMESTAMP
>
> ALTER TABLE X ALTER FIELD_DATE DEFAULT CURRENT_TIMESTAMP
>
> Regards,
> Mark P Ashworth
>