postgresql/contrib/postgres_fdw
Andrew Gierth 639bdbb96f postgres_fdw: don't push ORDER BY with no vars (bug #15352)
Commit aa09cd242 changed a condition in find_em_expr_for_rel from
being a bms_equal comparison of relids to bms_is_subset, in order to
support order by clauses on foreign joins. But this also allows
through the degenerate case of expressions with no Vars at all (and
hence empty relids), including integer constants which will be parsed
unexpectedly on the remote (viz. "ERROR: ORDER BY position 0 is not in
select list" as in the bug report).

Repair by adding an additional !bms_is_empty test.

Backpatch through to 9.6 where the aforementioned change was made.

Per bug #15352 from Maksym Boguk; analysis and patch by me.

Discussion: https://postgr.es/m/153518420278.1478.14875560810251994661@wrigleys.postgresql.org
2018-08-28 15:04:30 +01:00
..
expected Fix test case for 'outer pathkeys do not match mergeclauses' fix. 2018-01-30 14:55:14 -05:00
sql Fix test case for 'outer pathkeys do not match mergeclauses' fix. 2018-01-30 14:55:14 -05:00
.gitignore Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
connection.c Re-establish postgres_fdw connections after server or user mapping changes. 2017-07-21 12:51:38 -04:00
deparse.c Fix assorted fallout from IS [NOT] NULL patch. 2016-07-28 16:09:15 -04:00
Makefile Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:31 -04:00
option.c pgindent run for 9.6 2016-06-09 18:02:36 -04:00
postgres_fdw--1.0.sql Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.c postgres_fdw: don't push ORDER BY with no vars (bug #15352) 2018-08-28 15:04:30 +01:00
postgres_fdw.control Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.h pgindent run for 9.6 2016-06-09 18:02:36 -04:00
shippable.c Update copyright for 2016 2016-01-02 13:33:40 -05:00