Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHS2V-0004tA-1W for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Dec 2016 09:09:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cHS2U-0001jf-Kc for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Dec 2016 09:09:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cHS2T-0001gJ-22 for pgsql-hackers@postgresql.org; Thu, 15 Dec 2016 09:09:21 +0000 Received: from 173-164-140-181-sfba.hfc.comcastbusiness.net ([173.164.140.181] helo=fetter.org) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHS2P-0008Px-L0 for pgsql-hackers@postgresql.org; Thu, 15 Dec 2016 09:09:19 +0000 Received: by fetter.org (Postfix, from userid 1000) id A5238E01C3; Thu, 15 Dec 2016 01:09:16 -0800 (PST) Date: Thu, 15 Dec 2016 01:09:16 -0800 From: David Fetter To: PostgreSQL Development Subject: Re: Transaction oddity with list partition of a list partition Message-ID: <20161215090916.GB20659@fetter.org> References: <20161215082324.GA20659@fetter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161215082324.GA20659@fetter.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Thu, Dec 15, 2016 at 12:23:24AM -0800, David Fetter wrote: > Folks, > > I'm having some trouble understanding what's going on here. When I \i > the file in 55caaaeba877eac1feb6481fb413fa04ae9046ac without starting > a transaction explicitly, it produces the expected results. When I \i > it after a BEGIN, not so much. I've managed to get a shorter repro for the issue: BEGIN; CREATE TABLE the_log ( ts TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, "user" TEXT NOT NULL DEFAULT current_user, action TEXT NOT NULL, table_schema TEXT NOT NULL, table_name TEXT NOT NULL, old_row JSONB, new_row JSONB, CHECK( CASE action WHEN 'INSERT' THEN old_row IS NULL AND new_row IS NOT NULL WHEN 'UPDATE' THEN old_row IS NOT NULL AND new_row IS NOT NULL ELSE /*DELETE, and maybe TRUNCATE, if that's supported by access to old rows */ old_row IS NOT NULL AND new_row IS NULL END ) ) PARTITION BY LIST(table_schema); CREATE TABLE public_log PARTITION OF the_log FOR VALUES IN ('public'); INSERT INTO the_log (action, table_schema, table_name, new_row) VALUES ('INSERT','public','city','{"name": "Oakland", "population": 419267}'); leads to: ERROR: no partition of relation "the_log" found for row DETAIL: Failing row contains (2016-12-15 00:59:17.980094-08, shackle, INSERT, public, city, null, {"name": "Oakland", "population": 419267}). Per Thomas Munro, could it be that the CREATE ... PARTITION OF ... code fails to run CacheInvalidateRelcache on its parent(s)? Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers