Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct a defect in count subquery select clause calculation #136

Closed
wants to merge 1 commit into from
Closed

Correct a defect in count subquery select clause calculation #136

wants to merge 1 commit into from

Conversation

PLTGit
Copy link

@PLTGit PLTGit commented May 26, 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).

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).
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant