<p>Fixes 2 issues:</p>
<ol>
<li>
<p>Referenced column names from the HAVING clause were inappropriately<br>
attributed to the primary "me." table alias in all cases,  These now<br>
maintain appropriate provenance.</p>
</li>
<li>
<p>The same column being used as part of both the GROUP BY and the<br>
HAVING clauses ended up appearing multiple times in the reconstructed<br>
SELECT statement, causing confusion in the SQL engine (resulting in<br>
exceptions).  The HAVING clause components are now checked against all<br>
assembled SELECT members instead of just other HAVING members when<br>
performing deduplication.</p>
</li>
</ol>
<p>Adds a combined unit test covering both use cases, which failed on the<br>
prior version of the method.</p>
<p>Minor fixes:</p>
<p>Memoized the primary table alias prefix, since this was used in multiple<br>
string interpolations throughout the _count_subq_rs method (in one case,<br>
within a regex without explicit qualification or meta quoting; this has<br>
been turned into a safer (and faster) index call instead).</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>&nbsp;&nbsp;<a href='https://github.com/Perl5/DBIx-Class/pull/136'>https://github.com/Perl5/DBIx-Class/pull/136</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Correct a defect in count subquery select clause calculation</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/Perl5/DBIx-Class/pull/136/files#diff-5c086f1a6d1ac54926c39c849635b355">lib/DBIx/Class/ResultSet.pm</a>
    (19)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/Perl5/DBIx-Class/pull/136/files#diff-8c433e96bba96a551e30ff78f599b4b6">t/count/count_rs.t</a>
    (36)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/Perl5/DBIx-Class/pull/136.patch'>https://github.com/Perl5/DBIx-Class/pull/136.patch</a></li>
  <li><a href='https://github.com/Perl5/DBIx-Class/pull/136.diff'>https://github.com/Perl5/DBIx-Class/pull/136.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/Perl5/DBIx-Class/pull/136">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AACJ4ASOCEWLKWZKP3UXE33RTQSOPANCNFSM4NLDS6TQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AACJ4AVQNCSPMHHCWRRXB5TRTQSOPA5CNFSM4NLDS6T2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JKDR4AA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/Perl5/DBIx-Class/pull/136",
"url": "https://github.com/Perl5/DBIx-Class/pull/136",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>