<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"$B#M#S(B $B%4%7%C%/(B";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:"\@$B#M#S(B $B%4%7%C%/(B";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0mm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Arial",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"$B=q<0$J$7(B \($BJ8;z(B\)";
        margin:0mm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"$B#M#S(B $B%4%7%C%/(B";}
span.17
        {mso-style-type:personal-compose;
        font-family:"Arial",sans-serif;
        color:windowtext;}
span.a
        {mso-style-name:"$B=q<0$J$7(B \($BJ8;z(B\)";
        mso-style-priority:99;
        mso-style-link:$B=q<0$J$7(B;
        font-family:"$B#M#S(B $B%4%7%C%/(B";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Arial",sans-serif;}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:99.25pt 30.0mm 30.0mm 30.0mm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026">
<v:textbox inset="5.85pt,.7pt,5.85pt,.7pt" />
</o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="JA" link="#0563C1" vlink="#954F72" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoPlainText"><span lang="EN-US">Hi pgpool hackers,<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I found the following SQL will be cached, when enabled memory query cache,
<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;with cte as (insert into test2 values(1) returning *) select * from test2;&quot;<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I think the SQL has Data-Modifying Statements in with clause should not be cached.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Because Once cached, the Data-Modifying Statements will not be executed again which is not expected.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">It seems to be better to analyze the with clause like the following:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">--------For UPDATE/INSERT/DELETE type SQL:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extract oids from its with clause which will be invalidated.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">--------For SELECT type SQL:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Data-Modifying Statements in its with clause, the select will not be cached,<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and the oids from with clause will be invalidated too.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">What do you think?<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I try to solve the problem and made a patch for the code.<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Best regards,<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">houzj<o:p></o:p></span></p>
</div>
</body>
</html>