pgsql: Avoid doing catalog lookups in postgres_fdw's conversion_error_c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Avoid doing catalog lookups in postgres_fdw's conversion_error_c
Дата
Msg-id E1m0o3p-0006jj-7o@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Avoid doing catalog lookups in postgres_fdw's conversion_error_c
Список pgsql-committers
Avoid doing catalog lookups in postgres_fdw's conversion_error_callback.

As in 50371df26, this is a bad idea since the callback can't really
know what error is being thrown and thus whether or not it is safe
to attempt catalog accesses.  Rather than pushing said accesses into
the mainline code where they'd usually be a waste of cycles, we can
look at the query's rangetable instead.

This change does mean that we'll be printing query aliases (if any
were used) rather than the table or column's true name.  But that
doesn't seem like a bad thing: it's certainly a more useful definition
in self-join cases, for instance.  In any case, it seems unlikely that
any applications would be depending on this detail, so it seems safe
to change.

Patch by me.  Original complaint by Andres Freund; Bharath Rupireddy
noted the connection to conversion_error_callback.

Discussion: https://postgr.es/m/20210106020229.ne5xnuu6wlondjpe@alap3.anarazel.de

Branch
------
REL_11_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 14 +++--
contrib/postgres_fdw/postgres_fdw.c            | 82 ++++++++++++--------------
contrib/postgres_fdw/sql/postgres_fdw.sql      |  8 ++-
3 files changed, 51 insertions(+), 53 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Doc: add info about timestamps with fractional-minute UTC offset
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Reduce the cost of planning deeply-nested views.