db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dyre Tjeldvoll (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3343) Subsequent calls to PreparedStatement cause SQLIntegrityConstraintViolationException on column that is "Generated always"
Date Fri, 25 Jan 2008 10:24:34 GMT

     [ https://issues.apache.org/jira/browse/DERBY-3343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dyre Tjeldvoll updated DERBY-3343:
----------------------------------

    Attachment: d3343.v3.diff

Attaching another patch (v3) which fixes the javadoc typo and removes the try-finally cleanup.
It turns out that it was redundant, since setUp() turns autocommit off, and tearDown() issues
a rollback(). 

I do, however, think that the assertion that using a try-finally block will obscure failures
is not true in general. To test it I did the following:
- reverted the changes to ResultColumn
- set autocommit to true
- introduced a syntax error in the drop statement in the finally block

The drop-error was masked as expected but the call stack from JUnit was correct and showing
the correct error message (duplicate key).
The next testcase failed because table T already existed, as expected.

It is entirely possible that using a try-finally block like this is "not the JUnit way". I
would not know.

I have not run any other tests with this (v3) patch.

> Subsequent calls to PreparedStatement cause SQLIntegrityConstraintViolationException
on column that is  "Generated always"
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3343
>                 URL: https://issues.apache.org/jira/browse/DERBY-3343
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.2.1
>         Environment: gentoo linux amd64
>            Reporter: William Becker
>            Assignee: Dyre Tjeldvoll
>         Attachments: d3343.diff, d3343.v2.diff, d3343.v3.diff, defaults.sql
>
>
> The following series of statements fails:
> j> connect 'jdbc:derby:test;create=true';
> ij> create table t (id int primary key generated always as identity);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t(id) values (default)';
> ij> execute p;
> 1 row inserted/updated/deleted
> ij> execute p;
> ERROR 23505: The statement was aborted because it would have caused a duplicate key value
in a unique or primary key constraint or unique index identified by 'SQL080123140906700' defined
on 'T'.
> There is a more detailed discussion about it here: http://www.nabble.com/Generate-Always-and-SQLIntegrityConstraintViolationException-td15012038.html#a15018054

-- 
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