Incorrect NULL values on left joins in AutoRecord
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Anewt |
Invalid
|
Undecided
|
wouter bolsterlee |
Bug Description
When using AutoRecord:
Table1:
+--+-----+
|id|name1|
| 1|foo1 |
| 2|foo2 |
+--+-----+
Table2:
+--+-----+
|id|name2|
| 1|bar1 |
+--+-----+
> SELECT t1.id, t1.name, t2.id, t2.name FROM table1 t1 LEFT JOIN table2 t2 ON (t1.id = t2.id)
+--+-----+--+-----+
|id|name1|id|name2|
+--+-----+--+-----+
| 1|foo1 | 1|bar1 |
| 2|foo2 | | |
+--+-----+--+-----+
This will result in the following data structure:
$data = array(
array(
'id' => 1,
'name1' => 'foo1',
'name2 => 'bar1',
),
array(
'id' => NULL
'name1' => 'foo2',
'name2' => NULL
),
)
This is because the second 'id' overwrites the first one.
tags: | added: autorecord |
This was partially fixed in the experimental join multi code in anewt.new.cxs 1440
The rest is fixed in 1460:
1460 Sander van Schouwenburg 2009-04-15
[autorecord] BUGFIX: Invalid NULL values in left joins (Bug #361805)
This is the rest of the fix where a custom key was supplied.