[DBIx-Class-Devel] [Perl5/DBIx-Class] Correct a defect in count subquery select clause calculation (#136)

Paul Tomlinson notifications at github.com
Tue May 26 20:41:11 GMT 2020


Fixes 2 issues:

1. Referenced column names from the HAVING clause were inappropriately
attributed to the primary "me." table alias in all cases,  These now
maintain appropriate provenance.

2. The same column being used as part of both the GROUP BY and the
HAVING clauses ended up appearing multiple times in the reconstructed
SELECT statement, causing confusion in the SQL engine (resulting in
exceptions).  The HAVING clause components are now checked against all
assembled SELECT members instead of just other HAVING members when
performing deduplication.

Adds a combined unit test covering both use cases, which failed on the
prior version of the method.

Minor fixes:

Memoized the primary table alias prefix, since this was used in multiple
string interpolations throughout the _count_subq_rs method (in one case,
within a regex without explicit qualification or meta quoting; this has
been turned into a safer (and faster) index call instead).
You can view, comment on, or merge this pull request online at:

  https://github.com/Perl5/DBIx-Class/pull/136

-- Commit Summary --

  * Correct a defect in count subquery select clause calculation

-- File Changes --

    M lib/DBIx/Class/ResultSet.pm (19)
    M t/count/count_rs.t (36)

-- Patch Links --

https://github.com/Perl5/DBIx-Class/pull/136.patch
https://github.com/Perl5/DBIx-Class/pull/136.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/Perl5/DBIx-Class/pull/136
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20200526/26e808d9/attachment.htm>


More information about the DBIx-Class-Devel mailing list