Issue Details (XML | Word | Printable)

Key: DERBY-3343
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Dyre Tjeldvoll
Reporter: William Becker
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Subsequent calls to PreparedStatement cause SQLIntegrityConstraintViolationException on column that is "Generated always"

Created: 23/Jan/08 03:12 AM   Updated: 30/Jun/09 03:55 PM
Return to search
Component/s: SQL
Affects Version/s: 10.3.2.1
Fix Version/s: 10.3.3.0, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works d3343.diff 2008-01-23 10:55 AM Knut Anders Hatlen 0.9 kB
File Licensed for inclusion in ASF works d3343.v2.diff 2008-01-25 08:05 AM Dyre Tjeldvoll 4 kB
File Licensed for inclusion in ASF works d3343.v3.diff 2008-01-25 10:24 AM Dyre Tjeldvoll 4 kB
File Licensed for inclusion in ASF works defaults.sql 2008-01-23 04:07 PM Dyre Tjeldvoll 5 kB
Environment: gentoo linux amd64
Issue Links:
Reference
 

Bug behavior facts: Regression
Resolution Date: 26/Jan/08 04:07 PM


 Description  « Hide
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

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #615458 Sat Jan 26 16:06:23 UTC 2008 dyre DERBY-3343: Subsequent calls to PreparedStatement cause SQLIntegrityConstraintViolationException on column that is "Generated always"

Modifies the logic in ResultColumn.getOrderableVariantType() so that it behaves
correctly even when a default column is explicitly mentioned in an insert statement.

Merged with svn merge -r 615202:615203 ../derby-commit

Simple merge with no conflicts; no additional changes were necessary.
Files Changed
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ResultSetsFromPreparedStatementTest.java