pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352)
4+ messages / 1 participants
[nested] [flat]

* pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352)
@ 2018-08-28 14:07 Andrew Gierth <rhodiumtoad@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Andrew Gierth @ 2018-08-28 14:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bf2d0462cd735f76bcf6eb8b399723674b2221ef

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352)
@ 2018-08-28 14:07 Andrew Gierth <rhodiumtoad@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Andrew Gierth @ 2018-08-28 14:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8bc6a301b21cc189f5141c45be93938215e21fb7

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352)
@ 2018-08-28 14:07 Andrew Gierth <rhodiumtoad@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Andrew Gierth @ 2018-08-28 14:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/64eed263ac474433d17f05b23df3018a38e71fca

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352)
@ 2018-08-28 14:07 Andrew Gierth <rhodiumtoad@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Andrew Gierth @ 2018-08-28 14:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/639bdbb96fed7f8975111bf8081172fd8c7f623d

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2018-08-28 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28 14:07 pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352) Andrew Gierth <rhodiumtoad@postgresql.org>
2018-08-28 14:07 pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352) Andrew Gierth <rhodiumtoad@postgresql.org>
2018-08-28 14:07 pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352) Andrew Gierth <rhodiumtoad@postgresql.org>
2018-08-28 14:07 pgsql: postgres_fdw: don't push ORDER BY with no vars (bug #15352) Andrew Gierth <rhodiumtoad@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox