pgsql: Fix a few issues with REINDEX grammar

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Fix a few issues with REINDEX grammar
Дата
Msg-id E1oG9Br-001Gb5-9V@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix a few issues with REINDEX grammar

This addresses a couple of bugs in the REINDEX grammar, introduced by
83011ce:
- A name was never specified for DATABASE/SYSTEM, even if the query
included one.  This caused such REINDEX queries to always work with any
object name, but we should complain if the object name specified does
not match the name of the database we are connected to.  A test is added
for this case in the main regression test suite, provided by Álvaro.
- REINDEX SYSTEM CONCURRENTLY [name] was getting rejected in the
parser.  Concurrent rebuilds are not supported for catalogs but the
error provided at execution time is more helpful for the user, and
allowing this flavor results in a simplification of the parsing logic.
- REINDEX DATABASE CONCURRENTLY was rebuilding the index in a
non-concurrent way, as the option was not being appended correctly in
the list of DefElems in ReindexStmt (REINDEX (CONCURRENTLY) DATABASE was
working fine.  A test is added in the TAP tests of reindexdb for this
case, where we already have a REINDEX DATABASE CONCURRENTLY query
running on a small-ish instance.  This relies on the work done in
2cbc3c1 for SYSTEM, but here we check if the OIDs of the index relations
match or not after the concurrent rebuild.  Note that in order to get
this part to work, I had to tweak the tests so as the index OID and
names are saved separately.  This change not affect the reliability or
of the coverage of the existing tests.

While on it, I have implemented a tweak in the grammar to reduce the
parsing by one branch, simplifying things even more.

Author: Michael Paquier, Álvaro Herrera
Discussion: https://postgr.es/m/YttqI6O64wDxGn0K@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0a5f06b84de76939cf9805e4266d47c2e8bf66df

Modified Files
--------------
doc/src/sgml/ref/reindex.sgml              |  3 +--
src/backend/parser/gram.y                  | 36 ++++++++++++++---------------
src/bin/scripts/t/090_reindexdb.pl         | 37 ++++++++++++++++++++----------
src/test/regress/expected/create_index.out |  7 +++---
src/test/regress/sql/create_index.sql      |  2 ++
5 files changed, 49 insertions(+), 36 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Add test for session_preload_libraries and parameter permissions
Следующее
От: Amit Kapila
Дата:
Сообщение: pgsql: Eliminate duplicate code in table.c.