ORDER BY optimizer ignores equality propagation

Description

Re-filing this here from https://bugzilla.suse.com/show_bug.cgi?id=949520 :

Consider a query:

The join optimizer picks the join order of sa, su.
Table sa has an index which allows to satisfy ORDER BY LIMIT clause:

Good so far.

Now, let's try to change ORDER BY sa.id into ORDER BY su.id. The query
has sa.id = su.id, both columns have identical data types, so there should
be no difference.

However, there is:

ORDER BY optimizer no longer recognizes that index on sa.id produces the desired ordering.

Environment

None

Assignee

Sergei Petrunia

Reporter

Sergei Petrunia

Components

Sprint

None

Fix versions

Affects versions

Priority

Critical
Configure