pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Stuart <sfbarbee@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Errors creating partitioned tables from existing using (LIKE <table>) after renaming table constraints
Date: Fri, 14 Dec 2018 09:20:38 +0900
Message-ID: <20181214002038.GC2921@paquier.xyz> (raw)
In-Reply-To: <977c72a1-8d56-b77c-37de-808627033654@lab.ntt.co.jp>
References: <2047094.V130LYfLq4@station53.ousa.org>
	<977c72a1-8d56-b77c-37de-808627033654@lab.ntt.co.jp>

On Thu, Dec 13, 2018 at 06:03:35PM +0900, Amit Langote wrote:
> What's happening here is that when the ALTER TABLE RENAME CONSTRAINT is
> followed by CREATE TABLE (LIKE .. INCLUDING ALL) in the same session, the
> latter is referring to *stale* information about constraints of the source
> table.  You said it works correctly after you drop and re-create the
> constraint, but that's only because ALTER TABLE DROP/ADD CONSTRAINT will
> correctly invalidate the cached information, so that subsequent CREATE
> TABLE sees the correct information from the updated cache.  The way to fix
> it is to teach ALTER TABLE RENAME CONSTRAINT to reset the cached
> information.

This analysis looks right to me, and that's indeed a bug.  And as far as
I can see this is reproducible down to 9.4.  I cannot check your patch
in details today unfortunately, but I'll try to look at that in the next
couple of days and see if there are any surrounding issues.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (12+ messages)  latest in thread

Message-ID: <20181214002038.GC2921@paquier.xyz>
Permalink:  ../20181214002038.GC2921@paquier.xyz/
Also on:    postgresql.org/message-id/20181214002038.GC2921@paquier.xyz

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, Langote_Amit_f8@lab.ntt.co.jp, sfbarbee@gmail.com
  Subject: Re: Errors creating partitioned tables from existing using (LIKE <table>) after renaming table constraints
  In-Reply-To: <20181214002038.GC2921@paquier.xyz>
  References: <2047094.V130LYfLq4@station53.ousa.org> <977c72a1-8d56-b77c-37de-808627033654@lab.ntt.co.jp> <20181214002038.GC2921@paquier.xyz>

* 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