pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix table rewrites that include a column without a default.
Date: Wed, 16 Oct 2019 02:48:36 -0700
Message-ID: <20191016094836.nh3akqg2j72wncnz@alap3.anarazel.de> (raw)
In-Reply-To: <4541.1570742168@sss.pgh.pa.us>
References: <E1iIQrV-0005gk-1D@gemulon.postgresql.org>
	<3328.1570740683@sss.pgh.pa.us>
	<20191010205903.tj73q3qcyfft3izz@alap3.anarazel.de>
	<4541.1570742168@sss.pgh.pa.us>

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





view thread (7+ messages)

Message-ID: <20191016094836.nh3akqg2j72wncnz@alap3.anarazel.de>
Permalink:  ../20191016094836.nh3akqg2j72wncnz@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20191016094836.nh3akqg2j72wncnz@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix table rewrites that include a column without a default.
  In-Reply-To: <20191016094836.nh3akqg2j72wncnz@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox