<tt><font size=2>Len Jaffe &lt;lenjaffe@jaffesystems.com&gt; wrote on
06/19/2012 03:45:34 PM:<br>
<br>
&gt; From:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Len Jaffe &lt;lenjaffe@jaffesystems.com&gt;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; To:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; &quot;DBIx::Class user and developer list&quot; &lt;dbix-class@lists.scsys.co.uk&gt;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Date:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; 06/19/2012 03:49 PM</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Subject:</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Re: [Dbix-class] Search_rs not returning newly created rows</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; <br>
</font></tt>
<br><tt><font size=2>&gt; On Tue, Jun 19, 2012 at 3:22 PM, Kenneth S Mclane
&lt;ksmclane@us.ibm.com&gt; wrote:</font></tt>
<br><tt><font size=2>&gt; Len Jaffe &lt;lenjaffe@jaffesystems.com&gt; wrote
on 06/19/2012 02:06:21 PM:<br>
</font></tt>
<br><tt><font size=2>&gt; &gt; Can you share the&nbsp;relevant&nbsp;queries?
<br>
&gt; &gt; <br>
&gt; &gt; It may be that you're using an inner join when you need and outer
<br>
&gt; &gt; join if you can;t create the related records before the re-query.
<br>
&gt; &gt; <br>
</font></tt>
<br><tt><font size=2>&gt; This is the code with the prefetch commented
out.&nbsp;&nbsp;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; We were right. The prefetch is generating INNER JOINS, using the old<br>
&gt; grammar, rather than the JOIN grammer, so if you do not have the <br>
&gt; related records, you will not get the &quot;master&quot; records.</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; select *</font></tt>
<br><tt><font size=2>&gt; from foo, bar</font></tt>
<br><tt><font size=2>&gt; where foo.id = bar.foo_id &nbsp;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; will only return records where the join condition (foo.id = <br>
&gt; bar.foo_id) is true. &nbsp;But&nbsp;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; select *</font></tt>
<br><tt><font size=2>&gt; from foo</font></tt>
<br><tt><font size=2>&gt; left outer join bar on foo.id = bar.foo_id</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; will return a row for every row of foo&nbsp;and will return the data
from<br>
&gt; bar where the join condition is true, and tuples full of NULLs where<br>
&gt; there is not bar row that satisfies the join condition.</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; I'm going to punt here, and announce that implementing the outer <br>
&gt; join in DBIX/SQLA is left as an exercise for the reader.</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; But try the two queries above (modified for your database) from a
<br>
&gt; SQL prompt and compare &amp;&nbsp;contrast&nbsp;the results.</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Len.</font></tt>
<br><tt><font size=2>&gt; -&nbsp;depending&nbsp;on your database, you might
need to select foo.*, bar.* <br>
&gt; rather than just the generic *. in order to get the data from both
tables.</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; Len.&nbsp;</font></tt>
<br><tt><font size=2>&gt; <br>
&gt; -- <br>
&gt; lenjaffe@jaffesystems.com&nbsp;&nbsp; 614-404-4214 &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;&nbsp;</font></tt><a href=www.volunteerable.net><tt><font size=2>www.volunteerable.net</font></tt></a>
<br><tt><font size=2>&gt; Proprietor: </font></tt><a href=http://www.theycomewithcheese.com/><tt><font size=2>http://www.theycomewithcheese.com/</font></tt></a><tt><font size=2>
- An Homage to Fromage</font></tt>
<br><tt><font size=2>&gt; Greenbar:&nbsp;Grubmaster:&nbsp;2012-2009, Grub
Asst: 2008, Trained: 2007.</font></tt>
<br><tt><font size=2>&gt; <br>
Strangely, I found that without the prefetch I am getting all the data,
it's just that the columns are null as you said. It seems to do the left
outer join when left to it's own devices. I can still access the fields
in the related tables from my templates. I just added some template code
to compensate for the null fields.</font></tt>