db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: [PATCH] Derby 424 - Queryplan for a query using SESSION schema view is incorrectly put in statement cache. This could cause incorrect plan getting executed later if a temp. table is created with that name.
Date Wed, 19 Oct 2005 19:15:56 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks Mamta for the patch. I just have some comments and questions...
Thanks for commenting the changes well!<br>
<br>
1) Why there is a new method in GenericPreparedStatement? This doesn't
return any info about the PreparedStatement itself, so, does this
belong here? Why not just have the check qt.referencesSessionSchema()
in GenericStatement.java?<br>
<blockquote>+ public boolean referencesSessionSchema(QueryTreeNode qt)
  <br>
+ throws StandardException {<br>
+ //If the query references a SESSION schema table (temporary or
permanent), then mark so in this statement<br>
+ referencesSessionSchema = qt.referencesSessionSchema();<br>
+ return(referencesSessionSchema);<br>
+ }
  <br>
</blockquote>
2) Thanks for changing completeCompile() to NOT return
referencesSessionSchema flag... Seems like an ugly way to do it.<br>
<br>
3)&nbsp; You also mentioned:<br>
<blockquote>This information is again lost during the
optimization and generate phase and hence I moved the check for<br>
SESSION
schema reference to right after the bind phase in GenericStatement.<br>
</blockquote>
<blockquote>Do you know why this info is lost?<br>
</blockquote>
Thanks for the good patch.<br>
<br>
Satheesh<br>
<br>
Mamta Satoor wrote:
<blockquote
 cite="midd9619e4a0510182215v1c89581drdd0b3596a184ab42@mail.gmail.com"
 type="cite">
  <div>Hi,</div>
  <div>&nbsp;</div>
  <div>I have attached a review package for this bug to JIRA,
hopefully, in time for 10.1.2 release. </div>
  <p>The files affected by this change are<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\GenericStatement.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\compile\FromList.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\GenericPreparedStatement.java
  <br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\testing\org\apache\derbyTesting\functionTests\tests\lang\declareGlobalTempTableJava.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\testing\org\apache\derbyTesting\functionTests\master\declareGlobalTempTableJava.out</p>
  <p>The changes for this fix are very localized, affecting only 3
files in Derby engine. Basically, the problem is that, during the
compile phase of views, the reference to the view gets replaced by the
view definition, which causes us to loose the information that the view
might have belonged in SESSION schema. In order to fix this, during the
bind phase in FromList, before the view gets replaced by its
definition, I find out if the view is from SESSION schema, If yes, then
I save this information in FromList and this gets used by FromList when
it is asked if it has any items referencing SESSION schema objects.
This information is again lost during the optimization and generate
phase and hence I moved the check for SESSION schema reference to right
after the bind phase in GenericStatement. If there is a reference to
SESSION schema object, GenericStatement will remove the statement from
the cache. </p>
  <div>I have put in quite a big of comments in the code which
hopefully will make the patch easier to understand. I have added a new
test for this and have run all the tests with no failures using Sun's
jdk142 on Windows XP machine.
  </div>
  <div>&nbsp;</div>
  <div>thanks,</div>
  <div>Mamta</div>
</blockquote>
</body>
</html>


Mime
View raw message