pgsql: Split up pgfdw_report_error so that we can mark it pg_noreturn.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Split up pgfdw_report_error so that we can mark it pg_noreturn.
Дата
Msg-id E1uglQ3-001K6U-18@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Split up pgfdw_report_error so that we can mark it pg_noreturn.

pgfdw_report_error has the same design fault as elog/ereport
do, namely that it might or might not return depending on elevel.
While those functions are too widely used to redesign, there are
only about 30 call sites for pgfdw_report_error, and it's not
exposed for extension use.  So let's rethink it.  Split it into
pgfdw_report_error() which hard-wires ERROR elevel and is marked
pg_noreturn, and pgfdw_report() which allows only elevels less
than ERROR.  (Thanks to Álvaro Herrera for suggesting this naming.)

The motivation for doing this now is that in the wake of commit
80aa9848b, which removed a bunch of PG_TRYs from postgres_fdw,
we're seeing more thorough flow analysis there from C compilers
and Coverity.  Marking pgfdw_report_error as noreturn where
appropriate should help prevent false-positive complaints.

We could alternatively have invented a macro wrapper similar
to what we use for elog/ereport, but that code is sufficiently
fragile that I didn't find it appetizing to make another copy.
Since 80aa9848b already changed pgfdw_report_error's signature,
this won't make back-patching any harder than it was already.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/420221.1753714491@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/74e121c8dc5184318478dee587cf7d8303ab1357

Modified Files
--------------
contrib/postgres_fdw/connection.c   | 39 +++++++++++++++++++++++---------
contrib/postgres_fdw/postgres_fdw.c | 44 ++++++++++++++++++-------------------
contrib/postgres_fdw/postgres_fdw.h |  6 +++--
3 files changed, 55 insertions(+), 34 deletions(-)


В списке pgsql-committers по дате отправления: