Closed fbattke closed 1 year ago
Thanks for the report; this is indeed a bug. Could you check if my patch fixes your problem?
Thanks, that was super quick! We currently have no test instance with postgres >=13.10, so we can't install the 2.6 release of oracle_fdw. It may take a bit longer to get the patch tested, unfortunately.
I see, thanks for the feedback. It is dangerous to be running an old minor release of PostgreSQL.
Well, it is a test instance. Our production instance runs on current PostgreSQL. Unfortunately, we just learned that it is sometimes dangerous to run a current release of oracle_fdw in production. You're never 100% safe ;)
I try to keep Git HEAD in good shape, but nothing is perfect. Releases don't receive any special testing; I just slap on a tag and write release notes when a PostgreSQL major release is approaching.
Good to know! That makes me much more comfortable with using the patch in production as a replacement for a "real" release. Until now, I would only have used releases in production.
And it never hurts saying it: This is a really great tool and indeed the HEAD is in very good shape.
I have now tested e70be51 and the issue is fixed in my test case.
Thanks for the feedback!
We have found some constellations where LIMIT clauses are incorrectly pushed down to oracle before the WHERE clause is applied, leading to empty resultsets where results should have been found.
A prototypical example:
FOREIGN TABLE oracle_table ( id INT, oracle_value TEXT); TABLE postgres_table1(id INT, id2 INT, postgres_value1 INT); TABLE postgres_table2(id2 INT, postgres_value2 INT);
SELECT * FROM postgres_table1 JOIN oracle_table USING (id) JOIN postgres_table2 USING (id2) -- join against postgres_table1 WHERE oracle_table.oracle_value='A' AND postgres_table2.postgres_value2=5 LIMIT 1;
A workaround seems to be to adding an ORDER BY clause:
SELECT * FROM postgres_table1 JOIN oracle_table USING (id) JOIN postgres_table2 USING (id2) -- join against postgres_table1 WHERE oracle_table.oracle_value='A' AND postgres_table2.postgres_value2=5 ORDER BY id LIMIT 1;
This issue was introduced with 2.4 and is present in 2.5. We haven't yet have time to check 2.6, but from the git history I don't see an obvious change that would address it.