Re: BUG #16818: progress reporting ALTER TABLE ADD UNIQUE

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: BUG #16818: progress reporting ALTER TABLE ADD UNIQUE
Дата
Msg-id 20210111211313.GA25789@alvherre.pgsql
обсуждение исходный текст
Ответ на BUG #16818: progress reporting ALTER TABLE ADD UNIQUE  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #16818: progress reporting ALTER TABLE ADD UNIQUE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On 2021-Jan-11, PG Bug reporting form wrote:

> The progress reprorting for `ALTER TABLE test ADD UNIQUE (col)` is in
> `pg_stat_progress_create_index`. As it indeed creates an index, that is not
> too unexpected, but the `command` column of that view reports `CREATE
> INDEX`, and _that_ is somewhat unexpected. A reasonable expectation would be
> `ALTER TABLE ADD CONSTRAINT` or comparable. 

Hmm, seems a reasonable complaint.  Are there other command wordings
that would need to be handled?  I can't think of any (but I already
overlooked this one, evidently ...)

This seems fixed easily, in a way -- we'd need to set a distinct value
to the PROGRESS_CREATEIDX_COMMAND param when ALTER TABLE ADD; currently
possible values are in progress.h:

/* Commands of PROGRESS_CREATEIDX */
#define PROGRESS_CREATEIDX_COMMAND_CREATE        1
#define PROGRESS_CREATEIDX_COMMAND_CREATE_CONCURRENTLY    2
#define PROGRESS_CREATEIDX_COMMAND_REINDEX        3
#define PROGRESS_CREATEIDX_COMMAND_REINDEX_CONCURRENTLY    4

The problem is that we'd need to change system_view.sql to recognize the
new value, and we can't change that on existing systems.  If we fail to
adjust that view definition, the column will show NULL when the command
is ALTER TABLE ADD.

Something like the attached patch, but I haven't tried to compile it
yet.  Probably need docs adjustments also.


(Also: I don't see we set
PROGRESS_CREATEIDX_COMMAND_REINDEX_CONCURRENTLY anywhere ... an
oversight?)

-- 
Álvaro Herrera

Вложения

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16818: progress reporting ALTER TABLE ADD UNIQUE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16818: progress reporting ALTER TABLE ADD UNIQUE