Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlJel-0001d4-0P for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Nov 2021 23:38:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mlJek-00051m-0h for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Nov 2021 23:38:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlJej-00051d-Ih for pgsql-hackers@lists.postgresql.org; Thu, 11 Nov 2021 23:38:57 +0000 Received: from mail-ua1-x933.google.com ([2607:f8b0:4864:20::933]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mlJef-0004Zi-Op for pgsql-hackers@lists.postgresql.org; Thu, 11 Nov 2021 23:38:56 +0000 Received: by mail-ua1-x933.google.com with SMTP id t13so15253360uad.9 for ; Thu, 11 Nov 2021 15:38:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=oH07gsa4XP47URsWUpz7ITa50QY/QlxULxdsNbeb6ew=; b=BpOskJTntb+XjWNwRRlXyFPA1BZFVh+kGoxZsYAGv21vvmcrKKUK9Jfy8GPpC3UM9F 8lhoFTsR6z2C/iQfxY1gSxOMichIufKdTCNsPw6si/1ZsRYMqite/SqH0KQQ6/hlTdeU ur8S7LZEK0h4bvMd0P3/gXOqIwzV/l6dKTub+CAPVRNbpyIldSW0/eMvVBj/IwWJS+Nt ZtVz9NHT9GR/wwFjM3j3XkO29d9WMRt9pw9bZ/7BAJPthG2E1oI0jSfzebVzFG6uUT2m 3HM4N3Jg82sZgMwSDJJ1lRdjKcLIobKOMWD5+Fou9wOBO9mQ3aDGVzYUfpxaq9ho6y27 cijw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=oH07gsa4XP47URsWUpz7ITa50QY/QlxULxdsNbeb6ew=; b=X3/h84zFD10jU0ALGE9lyBfV1KstgUCgd+BsIbwgR24hxcMALm/0XwUAZhn+ND1SD1 LWlWFyDu8GOikc/KIlhAs/j2h9ELBVaI9YVeOPPAjPT5MpP1Ef6xAvSvssikPryNGdw9 7/1irYxQ0Jow5T+NTb7IcrHufxLcDN92hXR+zw2rt8xRaFYwOeYdkhTlheRzJPNFBWvl ikDNRFCThXG67FCrmiFSr6G30emjx/VU/mTa320OCSfYRMbmTVRICYAn4rm7Hi65ns9+ kqZbZufxbdCcyGfPmYSHI/K9cNdk0qOVHOZzwjkZTG/8n0GtUdXsGc9MkVhZvrMyaB7Z 95ig== X-Gm-Message-State: AOAM533WTOQKI/1P0Zx/DhazLmMIc652MjaoPS7f0yrymxLoq9LzOKRi s12XZLowq3L1GTSPQovRukv9qA== X-Google-Smtp-Source: ABdhPJxAwGUIwkmCY6g8iLfmmJmPURu3SM8JKLhfpCZ/t0OmY6njxab3zckuII9A7sVauH3Mnz21ow== X-Received: by 2002:ab0:2b96:: with SMTP id q22mr15983308uar.87.1636673932708; Thu, 11 Nov 2021 15:38:52 -0800 (PST) Received: from perhan.alvh.no-ip.org ([190.95.18.47]) by smtp.gmail.com with ESMTPSA id f11sm2941938vkk.50.2021.11.11.15.38.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 15:38:52 -0800 (PST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 739122A07D0; Thu, 11 Nov 2021 20:38:50 -0300 (-03) Date: Thu, 11 Nov 2021 20:38:50 -0300 From: Alvaro Herrera To: Tom Lane Cc: Amit Langote , vignesh C , Zhihong Yu , Corey Huinker , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: simplifying foreign key/RI checks Message-ID: <202111112338.3icgjvnzgkbn@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1623834.1636672752@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Nov-11, Tom Lane wrote: > It appears to me that commit 71f4c8c6f (DETACH PARTITION CONCURRENTLY) > broke the semantics here, because now things work differently with a > partitioned PK table than with a plain table, thanks to not bothering > to distinguish questions of how to handle partition detachment from > questions of visibility of individual data tuples. We evidently > haven't got test coverage for this :-(, which is perhaps not so > surprising because all this behavior long predates the isolationtester > infrastructure that would've allowed us to test it mechanically. > > Anyway, I think that (1) we should write some more test cases around > this behavior, (2) you need to establish the snapshot to use in two > different ways for the RI_FKey_check and ri_Check_Pk_Match cases, > and (3) something's going to have to be done to repair the behavior > in v14 (unless we want to back-patch this into v14, which seems a > bit scary). I think we (I) should definitely pursue fixing whatever was broken by DETACH CONCURRENTLY, back to pg14, independently of this patch ... but I would appreciate some insight into what the problem is. -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/ "Find a bug in a program, and fix it, and the program will work today. Show the program how to find and fix a bug, and the program will work forever" (Oliver Silfridge)