Consider constraints when suggesting join conditions

Looks like you are selecting constraints, so I've been wondering if they should already be considered when suggesting join conditions?

CREATE TABLE test_parent ( id NUMBER(9) PRIMARY KEY );
CREATE TABLE test_child ( id NUMBER(9) PRIMARY KEY, parent_id NUMBER(9) );

ALTER TABLE test_child ADD CONSTRAINT fk_test_child_parent
  FOREIGN KEY ( parent_id )
  REFERENCES test_parent ( id );

SELECT *
  FROM test_parent p
  JOIN test_child c ON ( c.|

image

Any chance of suggesting c.parent_id = p.id, which would be the most likely condition? Thanks!

1 Like

I'd say that's a bug. I'll log it.