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:

> Where I to use get_objects for table a, it would be reasonable to use a
> with_objects setting of: [ qw( b b.c ) ]
>
> However, this will fail to return any records for which table c cannot
> be found, despite the fact that table c is requested as a member of
> with_objects rather than require_objects.

If you do not want this behavior (say, because you're using a database
that does not enforce referential integrity on its foreign keys, even
when the columns involved are NOT NULL), then turn off the
refferential_integrity attribute for the foreign key that links b to
c:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/ForeignKey.pm#referential_integrity

> I believe the assumption is being misapplied in this particular
> case, due to the fact that we're using table b in a with_objects list
> rather than a require_objects list;  this is basically the same as
> saying "give me table a stuff, and give me tables b and c if you got
> 'em."  In such a case, my table a records should come through whether or
> not they have relations all the way out to table c via table b.

The conversion of certain with_objects args from left outer joins to
inner joins is a (useful! :) optimization that is made only when the
metadata supports it.  That is, only if it is a valid transformation
according to the information available.  Change the metadata to change
this behavior.

-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

Reply via email to