]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix null-pointer crash in postgres_fdw's conversion_error_callback.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 6 Oct 2021 19:50:24 +0000 (15:50 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 6 Oct 2021 19:50:24 +0000 (15:50 -0400)
commit36c9f7d96e1c95d45c7286a9355011289ab6c087
tree61603f37aa499e70faa062e0234816af2f183b48
parent0de8f9bc866a6a54ef891f07890d35455e5e6a00
Fix null-pointer crash in postgres_fdw's conversion_error_callback.

Commit c7b7311f6 adjusted conversion_error_callback to always use
information from the query's rangetable, to avoid doing catalog lookups
in an already-failed transaction.  However, as a result of the utterly
inadequate documentation for make_tuple_from_result_row, I failed to
realize that fsstate could be NULL in some contexts.  That led to a
crash if we got a conversion error in such a context.  Fix by falling
back to the previous coding when fsstate is NULL.  Improve the
commentary, too.

Per report from Andrey Borodin.  Back-patch to 9.6, like the previous
patch.

Discussion: https://postgr.es/m/08916396-55E4-4D68-AB3A-BD6066F9E5C0@yandex-team.ru
contrib/postgres_fdw/expected/postgres_fdw.out
contrib/postgres_fdw/postgres_fdw.c
contrib/postgres_fdw/sql/postgres_fdw.sql