You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org> on 2008/01/23 10:17:34 UTC

[jira] Commented: (DERBY-3343) Subsequent calls to PreparedStatement cause SQLIntegrityConstraintViolationException on column that is "Generated always"

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

Dyre Tjeldvoll commented on DERBY-3343:
---------------------------------------

Based on the comments so far, I'm guessing that the way to fix this is to extend HasVariantValueNodeVistor.visit(Visitable v) with special handling of ResultColumn objects. It doesn't seem reasonable to make all NumericConstantNodes be not constant, and ResultColumn appears to be where information about default value/auto-increment is kept. 

ResultColumn has, what appears to be, four relevant predicates:

isAutoincrement()

isAutoincrementGenerated()

isDefaultColumn()

isGenerated()

For the failing example, only isAutoincrementGenerated() returns true.
HasVariantValueNodeVistor.visit(Visitable v)  does not consider any of them.


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