diff -r f0ef12e25a2f -r 1ad0d5bc5083 lib/thingfish/metastore/pggraph/node.rb --- a/lib/thingfish/metastore/pggraph/node.rb Tue Nov 01 17:12:49 2016 -0700 +++ b/lib/thingfish/metastore/pggraph/node.rb Wed Nov 09 22:38:18 2016 -0800 @@ -54,9 +54,11 @@ # else if field.to_sym == :relationship - ds = self.join_edges.filter( Sequel.pg_jsonb( :edges__prop ).get_text( field.to_s ) => value ) + ds = ds.join_edges unless ds.joined_dataset? + ds = ds.filter( Sequel.pg_jsonb( :edges__prop ).get_text( field.to_s ) => value ) elsif field.to_sym == :relation + ds = ds.join_edges unless ds.joined_dataset? ds = self.join_edges.filter( :edges__id_p => value ) else