-
Notifications
You must be signed in to change notification settings - Fork 397
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
Bugfix: table alias and regular column name leads to cross join #1704
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
short run through the changes, if it helps
22bab59
to
fe321e1
Compare
9d0d19a
to
ff70ecb
Compare
Codecov Report
@@ Coverage Diff @@
## master #1704 +/- ##
============================================
- Coverage 88.24% 85.54% -2.70%
- Complexity 7704 7707 +3
============================================
Files 261 261
Lines 22084 22088 +4
============================================
- Hits 19488 18896 -592
- Misses 2596 3192 +596
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
ff70ecb
to
0f16793
Compare
@stereomon Thanks for the review/approval! @dereuromark Thank you for merging! What's up with Codecov recently? According to the page, this PR reduces coverage by 0.03% in one file, because I removed more lines than I added. Fair enough. But looking at the report, I apparently screwed up coverage across the whole project, mostly in unrelated files, like SqliteSchemaParser. Saw the same behavior in another PR. |
Maybe some codecov config is set wrongly? |
Maybe. Though googling "codecov unable to find commit on github waiting for ci" finds Codecov support tickets, that don't indicate user errors. |
Ok, so this drove me nuts for quite a while. When using aliases and regular column names (i.e. a.name instead of a.Name), queries broke horribly, as Propel inserted these columns with a cross join.
Example:
led to query
Same happened with regular query objects.
Turns out, around line 2100 in ModelCriteria.php, where column literals are resolved, checking if the aliased table name should be used was only done with phpNames, not normal names. This lead to the table being added twice to the from clause, once aliased and once normally, the latter without a join condition, causing the cross join.
Test cases only checked for phpNames, so it wasn't detected.
I kept running into this for quite a while, so I am happy to squash that bugger. Please, please make it go away for good.