db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dyre.Tjeldv...@Sun.COM
Subject Re: Generate Always and SQLIntegrityConstraintViolationException
Date Tue, 22 Jan 2008 17:05:06 GMT
Daniel John Debrunner <djd@apache.org> writes:

> Dyre.Tjeldvoll@Sun.COM wrote:
>
>> I'm currently running the tests with the following patch which seems to
>> fix the repro:
>>
>> Index: java/engine/org/apache/derby/impl/sql/execute/RowResultSet.java
>> ===================================================================
>> --- java/engine/org/apache/derby/impl/sql/execute/RowResultSet.java     (revision
614214)
>> +++ java/engine/org/apache/derby/impl/sql/execute/RowResultSet.java     (working
copy)
>> @@ -183,6 +183,7 @@
>>                         if (SanityManager.DEBUG)
>>                                 SanityManager.DEBUG("CloseRepeatInfo","Close of RowResultSet
repeated");
>>  +        cachedRow = null;
>>                 closeTime += getElapsedMillis(beginTime);
>>         }
>>
>>
>> If the tests pass, I'm ready to attach it to a Jira issue.
>
> That just defeats the purpose of cachedRow, which is the ability to
> re-use the same result across multiple executions (opens).

Bummer...

> I think the real bug is that canCacheRow is being passed in as true
> for the row of (default) when it should be false if the default column
> definition does not translate to a constant over time. 

So the compiler actually generates incorrect parameters for the
RowResultSet constructor in this case?

> With a default of CURRENT TIMESTAMP does the same problem occur?

Nope. Here is the result using an unpatched trunk:

ij version 10.4
ij> connect 'jdbc:derby:/tmp/db4;create=true';
ij> create table time(ts timestamp with default CURRENT_TIMESTAMP);
0 rows inserted/updated/deleted
ij> prepare p as 'insert into time(ts) values (default)';
ij> execute p;
1 row inserted/updated/deleted
ij> execute p;
1 row inserted/updated/deleted
ij> execute p;
1 row inserted/updated/deleted
ij> select * from time;
TS                        
--------------------------
2008-01-22 18:00:48.944   
2008-01-22 18:00:48.951   
2008-01-22 18:00:48.952   

3 rows selected


But I see in the debugger that canCacheRow is false in this case,
whereas it was true in previous case...

-- 
dt

Mime
View raw message