pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Michael Paquier <michael@paquier.xyz>
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 11:19:16 +0900
Message-ID: <d6975ae7-e82a-75d7-fe35-91145cb6265b@lab.ntt.co.jp> (raw)
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>

On 2018/12/14 9:20, Michael Paquier wrote:
> 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.

Thank you for looking.  I noticed that the previously posted patch doesn't
apply as is to branches before 11, so here are the patches that apply to
9.4 to 10 branches.

Regards,
Amit

Attachments:

  pg10-0001-Make-rename_constraint_internal-invalidate-relcache.patch (text/plain, 0B) download

view thread (12+ messages)  latest in thread

Message-ID: <d6975ae7-e82a-75d7-fe35-91145cb6265b@lab.ntt.co.jp>
Permalink:  ../d6975ae7-e82a-75d7-fe35-91145cb6265b@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/d6975ae7-e82a-75d7-fe35-91145cb6265b@lab.ntt.co.jp

 ·  · 

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: Langote_Amit_f8@lab.ntt.co.jp, michael@paquier.xyz, sfbarbee@gmail.com
  Subject: Re: Errors creating partitioned tables from existing using (LIKE <table>) after renaming table constraints
  In-Reply-To: <d6975ae7-e82a-75d7-fe35-91145cb6265b@lab.ntt.co.jp>
  References: <2047094.V130LYfLq4@station53.ousa.org> <977c72a1-8d56-b77c-37de-808627033654@lab.ntt.co.jp> <20181214002038.GC2921@paquier.xyz> <d6975ae7-e82a-75d7-fe35-91145cb6265b@lab.ntt.co.jp>

* 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