db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5161) Cannot rollback after syntax error in internal statement
Date Tue, 29 Mar 2011 13:23:05 GMT

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

Knut Anders Hatlen updated DERBY-5161:
--------------------------------------

    Attachment: cleanupOnError.diff

I ran the regression tests on the finally.diff patch and saw two failures in derbyall:

lang/subquery.sql
lang/subquery2.sql

All diffs were similar to this one:

********* Diff file derbyall/derbylang/subquery2.diff
*** Start: subquery2 jdk1.6.0_21 derbyall:derbylang 2011-03-29 14:03:32 ***
1017 del
< 2 dependencies found                                                                
                       
1017a1017
> 12 dependencies found                                                               
                       
Test Failed.
*** End:   subquery2 jdk1.6.0_21 derbyall:derbylang 2011-03-29 14:03:44 ***

The problem appears to be that some dependencies aren't cleared when we pop the statement
context after a syntax error. I think we should use StatementContext.cleanupOnError() instead
of LanguageConnectionContext.popStatementContext() when an exception has been thrown. cleanupOnError()
will call popStatementContext() after first clearing the dependencies that made subquery.sql
and subquery2.sql fail.

The attached patch cleanupOnError.diff changes GenericStatement.prepMinion() so that it uses
cleanupOnError() in the exception case. subquery.sql and subquery2.sql pass with that change,
and the patch still fixes the rollback error in the bug repro.

> Cannot rollback after syntax error in internal statement
> --------------------------------------------------------
>
>                 Key: DERBY-5161
>                 URL: https://issues.apache.org/jira/browse/DERBY-5161
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: cleanupOnError.diff, finally.diff
>
>
> To reproduce, execute the statements below in ij. Can only be reproduced this way before
DERBY-5157. I don't know how to reproduce it when that bug is fixed.
> ij version 10.7
> ij> connect 'jdbc:derby:db;create=true';
> ij> autocommit off;
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> alter table t add column """" int default 42;
> ERROR 42X01: Syntax error: Encountered "\"" at line 1, column 22.
> Issue the 'help' command for general information on IJ command syntax.
> Any unrecognized commands are treated as potential SQL commands and executed directly.
> Consult your DBMS server reference documentation for details of the SQL syntax supported
by your server.
> ij> rollback;
> ERROR X0Y67: Cannot issue rollback in a nested connection when there is a pending operation
in the parent connection.
> The error message implies that we've called rollback() on a nested transaction, whereas
we're in fact called it on the parent transaction.
> Expected result: The rollback statement should abort the transaction without raising
any errors.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message