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


Reply via email to