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

Daniel John Debrunner commented on DERBY-3037:
----------------------------------------------

This is a similar issue to DERBY-3304 where the commit inside of a routine 
closes the language result set that is executing the routine.
It seems that the commit() needs to be smarter about which language result sets 
to close. It's not just the current one that's the issue, actually any that are 
actively in use. E.g. If a procedure P1 calls procedure P2 which calls 
procedure P3 and P3 commits, then current all the language result sets will be 
closed (ignoring held result sets), but the language result sets 
(CallStatementResultSets) for P1, P2 and P3 should remain open.

For functions it's a similar problem, though it's complicated by that fact that 
a function is called from a language result set that returns rows, whereas a 
procedure is not. So with a SQL select executed through a JDBC statement with 
close result sets on commit:

    SELECT f(a) FROM T

if f(a) commits then is the JDBC ResultSet that is processing the query closed, 
meaning that its next next() call will thrown an exception?


> Language ResultSet.finish() is called even when the ResultSet is going to be 
> re-used.
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3037
>                 URL: https://issues.apache.org/jira/browse/DERBY-3037
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.0.0
>            Reporter: Daniel John Debrunner
>            Assignee: Mamta A. Satoor
>             Fix For: 10.3.2.2, 10.4.0.0
>
>         Attachments: DERBY3037_patch_not_ready_for_commit_v2_diff.txt, 
> DERBY3037_patch_not_ready_for_commit_v2_stat.txt, 
> Derby_3037_AlterTableConstantActionChanges_v1_diff.txt, 
> Derby_3037_AlterTableConstantActionChanges_v1_stat.txt, DERBY_3304_Repro.java
>
>
> DERBY-827 (correctly) changed the lifetime of the language ResultSet tree to 
> be the lifetime of the activation, but did not fix up the correct calls to 
> ResultSet.close() and ResultSet.finish().
> A language ResultSet's lifetime should be driven by the activation, so 
> activation.close() should call finish() on its ResultSet.
> EmbedResultSet should call close on its language ResultSet (theResults field) 
> when the JDBC ResultSet is closed, it should not be calling finish() on its 
> ResultSet.
> See comments in DERBY-827 for some more details and issues.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to