I have a setup where a 9.6.1 server uses postgres_fdw to connect to a 9.4.9 hot standby server.
I have a DML statement which triggers the error:
ERROR: XX000: outer pathkeys do not match mergeclauses
LOCATION: create_mergejoin_plan, createplan.c:3722
The error first starts appearing with this commit (on the local side):
commit aa09cd242fa7e3a694a31f8aed521e80d1e626a4
Date: Wed Mar 9 10:51:49 2016 -0500
postgres_fdw: Consider foreign joining and foreign sorting together.
The version of the remote side does not seem to matter. I've also promoted a test instance of the remote from hot standby to master and then upgraded to 9.6.1, and neither step fixes the issue.
The statement is like this:
Where foo_remote is a pretty complicated view (defined locally) over the join of 8 foreign tables.
I am having trouble producing a self-contained, disclosable test case for this. Small changes causes the error to go away. On the local side, it doesn't seem to depend on the contents of the table, only the structure. But on the remote side, truncating the central table for the query makes the error go away.
Any tips on investigating this further in situ? Or is the best option just to work harder on a minimal and disclosable test case?
Cheers,
Jeff