Daniel Lundin <daniel(at)helena-daniel(dot)se> writes:
> I would have thought that the planner would notice that child.parent =
> parent.id = 1193, implies that child.parent = 1193,
Nope, it does not.
It will notice transitive equality of variables, but that happens to
fall out of processing that it has to do anyway to recognize sort keys
for mergejoins. Constants aren't interesting for join planning so they
are not handled in that code.
Offhand I do not see a way of recognizing this case that wouldn't expend
a great deal more cycles than it's likely to be worth.
regards, tom lane