postgres_fdw: Refuse to send FETCH FIRST WITH TIES to remote servers.
authorEtsuro Fujita <efujita@postgresql.org>
Fri, 7 Jun 2024 08:45:02 +0000 (17:45 +0900)
committerEtsuro Fujita <efujita@postgresql.org>
Fri, 7 Jun 2024 08:45:02 +0000 (17:45 +0900)
commit8405d5a37a25c53e568b2bf290a0ba5189940190
treeca36fc1adb2bbf6ba477d43b2acf7eacbbb505e5
parentd9ff92c235226f68bbafcc8bb5260a8a51aedec1
postgres_fdw: Refuse to send FETCH FIRST WITH TIES to remote servers.

Previously, when considering LIMIT pushdown, postgres_fdw failed to
check whether the query has this clause, which led to pushing false
LIMIT clauses, causing incorrect results.

This clause has been supported since v13, so we need to do a
remote-version check before deciding that it will be safe to push such a
clause, but we do not currently have a way to do the check (without
accessing the remote server); disable pushing such a clause for now.

Oversight in commit 357889eb1.  Back-patch to v13, where that commit
added the support.

Per bug #18467 from Onder Kalaci.

Patch by Japin Li, per a suggestion from Tom Lane, with some changes to
the comments by me.  Review by Onder Kalaci, Alvaro Herrera, and me.

Discussion: https://postgr.es/m/18467-7bb89084ff03a08d%40postgresql.org
contrib/postgres_fdw/expected/postgres_fdw.out
contrib/postgres_fdw/postgres_fdw.c
contrib/postgres_fdw/sql/postgres_fdw.sql