pgsql: Reduce risks of conflicts in internal queries of REFRESH MATVIEW

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Reduce risks of conflicts in internal queries of REFRESH MATVIEW
Дата
Msg-id E1logsh-0005Jz-VZ@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Reduce risks of conflicts in internal queries of REFRESH MATVIEW CONCURRENTLY

The internal SQL queries used by REFRESH MATERIALIZED VIEW CONCURRENTLY
include some aliases for its diff and temporary relations with
rather-generic names: diff, newdata, newdata2 and mv.  Depending on the
queries used for the materialized view, using CONCURRENTLY could lead to
some internal failures if the matview query and those internal aliases
conflict.

Those names have been chosen in 841c29c8.  This commit switches instead
to a naming pattern which is less likely going to cause conflicts, based
on an idea from Thomas Munro, by appending _$ to those aliases.  This is
not perfect as those new names could still conflict, but at least it has
the advantage to keep the code readable and simple while reducing the
likelihood of conflicts to be close to zero.

Reported-by: Mathis Rudolf
Author: Bharath Rupireddy
Reviewed-by: Bernd Helmle, Thomas Munro, Michael Paquier
Discussion: https://postgr.es/m/109c267a-10d2-3c53-b60e-720fcf44d9e8@credativ.de
Backpatch-through: 9.6

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/187682c3217375c9b70417bf3235790f639e8e7e

Modified Files
--------------
src/backend/commands/matview.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: doc: Group options in pg_amcheck reference page
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: Reduce risks of conflicts in internal queries of REFRESH MATVIEW