Fixes #1791: support ON condition for relational query.