On 4/23/07, Ethan Rowe <[EMAIL PROTECTED]> wrote: >>> Table b has an FK to table a. Table b also has an FK to table c. These FK >>> columns are all NOT NULL constrained. >> >> If that is the case, and if referential integrity is turned on for the >> foreign key that links b to c, then you are telling RDBO that no row in b can >> ever exist without a corresponding row in c. Thus, the behavior you observe >> is valid: >> > If I was using table b as the foundation of the query (i.e. > MyApp::Model::B::Manager->get_objects()), then I would agree with you. But I'm > not; I'm using table *a* as the foundation (i.e. > MyApp::Model::A::Manager->get_objects()), which does not have an FK to table b > -- it only has a one-to-many relationship to table b. Thus, by putting b and > b.c in 'with_objects', I'm saying that I definitely want my 'a' records, and > whatever 'b' and 'b.c' records there might be (excluding any additional limits > I choose to put in the where clause).
As an aside, having both "b" and "b.c" in a (with|require)_objects parameter value is redundant. Mentioning b.c is sufficient to get both. > Doesn't putting 'b' in the 'with_objects' set make 'b' records desired > -- but, critically, optional -- for the query result? In which case, > while the behaviors regarding foreign keys with full referential > integrity enabled are appropriate in determining what 'b' records (and > 'c' records) show up in the result, it should not influence whether an > 'a' record can or cannot be returned? That's the point of my email; > this relationship between b and c and its surrounding rules are > preventing the 'a' records from showing up, when I've asked for 'b' > records in a "give 'em if you've got 'em" fashion (as opposed to the > "only give 'em if its got 'em" approach of 'require_objects'). > > Does that make more sense? Yes, thanks. It's supposed to be doing what you expect it to do, but it's not doing it due to a bug. I'll think about the best way to fix it. I could of course just remove the optimization, but I have a few other ideas. Thanks for the report. -John ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object