On Jan 5, 5:34 am, Sandeep <[email protected]> wrote:
> hi,
> consider    DB[:node].graph(:term_node, {:node__nid
> => :term_node__nid}, :join_type=>:inner)
> At this point, I have a resultset that has a value :node__type that
> actually tells me the *partial name* of the NEXT table that I need to
> join.

No, you don't have a resultset at all, you have a dataset, and no
query has yet been sent to the database (except maybe to get the
columns in a table).  When the query is run on the database, it could
easily have multiple distinct values for node.type, in which case how
would you know which table to join to?

Polymorphic behavior in the database is anti-relational, and should be
avoided unless absolutely necessary.  It makes it so that you cannot
enforce referential integrity, and makes it impossible to do the join
you are proposing in a single query.  In the cases where you really
need polymorphic behavior, a relational database is often a bad choice
for data storage.

It's possible the class_table_inheritance plugin could help with your
use case, but as you haven't posted the underlying issue you are
trying to solve, it's difficult to say for sure.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to