Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heJal-0000WX-NY for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Jun 2019 13:28:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1heJak-00033t-DT for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Jun 2019 13:28:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heJaj-00033m-W4 for pgsql-bugs@lists.postgresql.org; Fri, 21 Jun 2019 13:28:34 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heJag-0003Oh-QY for pgsql-bugs@lists.postgresql.org; Fri, 21 Jun 2019 13:28:32 +0000 Received: by mail-qt1-x842.google.com with SMTP id s15so6832964qtk.9 for ; Fri, 21 Jun 2019 06:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=qt6KB/SFwTM6pVi1kkVaHb2nvCAJmmYz4EWiVnPqO/4=; b=hCKYAK/dsc3bKcms+jgXijEIK0aC6rPP7oAl5XDsx6U4f+j3v4P+wF7hkL3hm2GAnY tqcDIH5G0KUOwelqdZTXqAvyMyEy2QkPH437KGLiKICbHXPWtHZL8A4B6NAArfSOZMdD QZ9lTm2UM2+50DkY0/jsvmTLrhpdeqBtbFl+7mq6gywgIN5VVrMRcXdujuCHAfwgB+dc zTzBp6V7kUOQjwPQmSJgVX/4uMfUsdsXRMKoKbpT3dShP37POCAUiFrhprrICafE3Dwb uqrSfbyWl6yhIqFUy0Vd/Y5fGyoQPDNvPjvtiGulc896N2ihaQHeGPMYGFt/+BjutcSu U8qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=qt6KB/SFwTM6pVi1kkVaHb2nvCAJmmYz4EWiVnPqO/4=; b=Mh488fyQ0/eh26SCIsPIHmEa/LOJKrJY1Deh2eAwBitXGLg2W4wyfPzrzgIv/CpKT9 8iUwqBRjrbXL3z/pFFThz8PhZa/vtk0sroOP4vDDLj1QknG8hz9TCigqyZwO8GUmqx8h AOjbx2jQqAsNu6L0LJhfoAoVNvRjyCrosogv7LHtfiUDt45vwq7k54nkxpGxKpO0zHUT 2/uD0/NVbBMcBNUiHjcaZOmq7RLJFgYVFaKccQcuKlIIe/6uYvMNaTC0JYVqQrybRPob sAib3X0MYCMg9odFg/6ck6gMmUlSgXYzJc/V7/A58aRwk7/2Ccae7RwRwFXHrMNKjU5l rVHQ== X-Gm-Message-State: APjAAAW9f9l/2TuKcm+JN3XY2TdiralID43lKpB8bXREc1CPZT+6I7S1 zVu+5GtrUpvUfEbuvNUGBEtcDg== X-Google-Smtp-Source: APXvYqxWg9376PR9r988ielvAkfxUawVaT2P2iSYfQqe+VhmDBUDeIinRNomm2GDZ2GgYi3/UYdDJg== X-Received: by 2002:ac8:21f2:: with SMTP id 47mr103632412qtz.38.1561123710028; Fri, 21 Jun 2019 06:28:30 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([191.125.99.86]) by smtp.gmail.com with ESMTPSA id 6sm1378259qkk.69.2019.06.21.06.28.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 06:28:29 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id D26A412079A; Fri, 21 Jun 2019 09:28:23 -0400 (-04) Date: Fri, 21 Jun 2019 09:28:23 -0400 From: Alvaro Herrera To: "Rozboril, Robert" Cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: PostgreSQL v11.3 - Records are deleted from child table if partition key of parent table is changed Message-ID: <20190621132823.GA8023@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Robert, AFAIU the problem is that when the pof tuple migrates to pot, the partition-level FK constraint on polf sees the update as a delete (because at that level that's what it is) and thus cascades to delete the tuple on polf. There is nothing that automagically instantiates a new tuple in polt. To fix this problem, we would need a mechanism to insert an equivalent referencing tuple in the other partition. I'm not sure how would we achieve such a thing. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services