Allow LIMIT pushdown in postgres_fdw with empty ORDER BY pathkeys When all of the ORDER BY clause's PathKeys are redundant due to consts in all of the pathkeys' EquivalenceClasses, sort_pathkeys is NIL, but query_pathkeys may then get set to setop_pathkeys, which may not be shippable. add_foreign_ordered_paths() previously used the shippability of query_pathkeys to decide whether the UPPERREL_ORDERED step was safe to push down, which needlessly prevented the subsequent UPPERREL_FINAL step from pushing down the LIMIT. No sort is needed in this case, so just mark the ordered step as pushdown-safe.
Author: David Rowley <[email protected]> Reviewed-by: Robins Tharakan <[email protected]> Discussion: https://postgr.es/m/caep4nawnsefmi4w+89xbhq0f-0oixcyujo9kvcbxsyl8l4r...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b6178c942ea7a85f72beb6a775d2793062a7ff8e Modified Files -------------- contrib/postgres_fdw/expected/postgres_fdw.out | 10 ++++++++++ contrib/postgres_fdw/postgres_fdw.c | 14 ++++++++++---- contrib/postgres_fdw/sql/postgres_fdw.sql | 4 ++++ 3 files changed, 24 insertions(+), 4 deletions(-)
