Re: pgsql: Fix table rewrites that include a column without adefault.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pgsql: Fix table rewrites that include a column without adefault.
Дата
Msg-id 20191016094836.nh3akqg2j72wncnz@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: pgsql: Fix table rewrites that include a column without a default.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
Hi,

On 2019-10-10 17:16:08 -0400, Tom Lane wrote:
> If you just want to verify that a rewrite happened or didn't happen,
> seems like you could check whether the table's relfilenode changed.
> 
> regression=# select relfilenode as oldfilenode from pg_class where relname = 'rewrite_test'
> regression-# \gset
> regression=# select relfilenode != :oldfilenode as changed from pg_class where relname = 'rewrite_test';
>  changed 
> ---------
>  f
> (1 row)
> regression=# alter table rewrite_test alter column notempty3_norewrite type bigint;
> ALTER TABLE
> regression=# select relfilenode != :oldfilenode as changed from pg_class where relname = 'rewrite_test';
>  changed 
> ---------
>  t
> (1 row)

This felt verbose to me over a number of to-be-tested statements, so I
instead replaced it with a plpgsql function that EXECUTEs the DDL and
returns whether a rewrite happened. I'll assume/hope that that fixes the
occasional bf failures.

Greetings,

Andres Freund



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Refresh some incorrect links in pg_crc.c/h
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Replace alter_table.sql test usage of event triggers.