Ticket #1175 (closed defect: fixed)

Opened 12 months ago

Last modified 12 months ago

Left Join to multiple child classes of inheritance

Reported by: gnat Owned by: romanb
Priority: major Milestone:
Component: Inheritance Version: 0.11.0
Severity: Keywords: inheritance, joins
Cc: Has Test: yes
Status: Pending Core Response Has Patch: no

Description (last modified by gnat) (diff)

When using inheritance, and left joining to multiple tables, nothing is returned. If the portion of the where clause dealing with inheritance was moved into the ON clause of the join, it would work properly.

Attachments

inheritanceLeftJoin.patch (3.1 KB) - added by gnat 12 months ago.
initial patch - still causes regressions…
1175.patch (29.0 KB) - added by jwage 12 months ago.
Final patch that has been cleaned up and optimized.

Change History

Changed 12 months ago by gnat

  • owner changed from jwage to romanb
  • component changed from Attributes to Inheritance

Changed 12 months ago by gnat

  • has_test set

Changed 12 months ago by gnat

initial patch - still causes regressions...

Changed 12 months ago by gnat

  • description modified (diff)

some clarifications in talking with jwage:

whenever left joining to a inheritance table the type=X needs to be in the ON part

when selecting from an inheritance based table the type=X should be in there WHERE part

There are a few theoretical ways to solve this.

change the applyInheritance() function in the Query object to accept a table and return any inheritance needed for that table. in the _buildSqlFromPart() function would call it for all left joins, and then in getSqlQuery, you'd pass in the from table to add the condition to the WHERE clause.

Another potential solution is to make the leftJoin function add the inheritance to the _pendingJoinConditions automatically, and modify applyInheritance() to only deal with the from() table.

Changed 12 months ago by jwage

This latest 1175.patch fixes the problem but if we can confirm that it doesn't break anything and that it is ok. I think we need to clean it up to have applyFromWhereInheritance() function and applyJoinInheritance($table), or something similar. Just to clean it up a bit.

Changed 12 months ago by jwage

Final patch that has been cleaned up and optimized.

Changed 12 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed

(In [4572]) fixes #1175

Changed 12 months ago by anonymous

  • milestone 0.11.3 deleted

Milestone 0.11.3 deleted

Note: See TracTickets for help on using tickets.