Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tb6Ui-0082gk-Tz for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 23:20:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tb6Uh-006Fg5-U9 for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 23:20:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tb6Uh-006Ffw-Fx for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2025 23:20:15 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tb6Ue-001Ad6-2D for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2025 23:20:14 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-216401de828so26410995ad.3 for ; Thu, 23 Jan 2025 15:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20230601.gappssmtp.com; s=20230601; t=1737674412; x=1738279212; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=8+V5KBLMBz8nUnDam4tetRiCOMLpEcHJ54wIV1yj1ls=; b=UDb/aJtUuO/IIVxjFjFMrFSB6fEiAdCxAR3Bc9fvnaoGonRIcdPsipLpabU10ru00g 0VTos6yRSDaUUnZlLdfTtZTMAYGVHIAOiMoXqJv/S68BYv0o9B6CgxEhROW+tIhPwUIU 5gXP+ACEq5ba++aY3Ums8KfJDVlb2K8VNzwJu2vIw3R3CcRU43dDkPShYmelsNfiKiaP H8fMHb9MaWRDTD9YzUY3BJv60O3z127yvfdmfYIYDFanR4BbrTX2Z46nnqtdZsUeOZCs 9z0ANi1iGK29uY3s2S9yaaPRBdCq3OgxRiF99jWE003f6Z24TTu28dMtiRqJFwey3V1B 2K6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737674412; x=1738279212; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8+V5KBLMBz8nUnDam4tetRiCOMLpEcHJ54wIV1yj1ls=; b=V9qfhYUfk5M7qPGnHXcE2OSURBwfw8UFABJ0PwJkEuyrf0EasNsvDJE7Bl7DaQdKZY wqXKnFnpZ2E9hdgq/YfJ+/B6nhtaCZmhjpjll4mNxMqN4iI6AhV1Cd/seYQibo1aEeqA Lvw2z4qgoQxdksotZSgkt3GMqEDhP/P5obhv55fS4ZOkB9q2R/ljXLT95eYOqzqIVpHY jZMVpbtPXarWBpxz1xRkB9Z2g/dvIS0ljDnWng70rSDAEvQQ4zpgUa4wM1uaD5Xeq0DO KwNvXT1BvpwkVOZ2tkcjZHtvXegz4Y4mYv1RujcbNRQ8ambe42M8wsqYI09fS4fb/xnd Tzbw== X-Forwarded-Encrypted: i=1; AJvYcCVwPfnU2MAjWsWChd5ubZFffN8lU2V9mlxpKlR++koCxqW0BzXlmZA2kDwJduQHhvxqUE7j8iYm5JbqORDC@lists.postgresql.org X-Gm-Message-State: AOJu0Yybvpasdrh02HaADybqmc8LpvRpjyTf0JwjXULkLehE7GSpHAG2 a8tPl8WAqA8NBI4EqGsPn23M3ppz5tzD1mAwzBR3etYIDNmKgZ0h5tcTU1IDoBE= X-Gm-Gg: ASbGnctOo/ZptiaKikJTqf3+RgMoj6/OXm/bpVRBuXywYFkSspbhr7jN6oMDKZKISNt KtT3KzmeuWyX5Z35ZYaiSCmWEia/8MyQiIPbsSYM2ljMbvHFX3PHV0hDXpPn0uL2hqaAPd/ue1F R4ZKUTuEQ7wHnG5SwG9YzFlEPsre9yVRLDBDUZpk9fgvJ3dM6mn9gEiD15vv1d12zsc4e1dpXkJ oNjKKOIgmC7XmzbdOr22X2pedO6XEpPIKhfcfpEmYiJ4b0GDOAaa/A9XgfykthkSZwJRaFa10yH 6cYyjbwcVxDyKU5WXsCY8mEkL4r4 X-Google-Smtp-Source: AGHT+IG5LsOmr50quyD+pkBtJFX5+TIcSefzrIrVKdbK0iREmi0CzcR0LsCPtjd16QBuvPa+nXQPSw== X-Received: by 2002:a17:902:d510:b0:212:5786:7bbe with SMTP id d9443c01a7336-21c3550e908mr477175935ad.24.1737674411784; Thu, 23 Jan 2025 15:20:11 -0800 (PST) Received: from [192.168.2.139] ([50.39.255.79]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-21da4141c4esm4239405ad.110.2025.01.23.15.20.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jan 2025 15:20:10 -0800 (PST) Message-ID: Date: Thu, 23 Jan 2025 15:20:10 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SQL:2011 application time To: Peter Eisentraut Cc: Tom Lane , jian he , PostgreSQL Hackers , vignesh C References: <57ea0668-5205-426e-b934-efc89f2186c2@illuminatedcomputing.com> <6dc196d4-8853-49d7-8dd3-e391058451c1@eisentraut.org> <66e47fc0-77b7-4763-9b70-5c0b7ff15f21@eisentraut.org> <333d3886-b737-45c3-93f4-594c96bb405d@eisentraut.org> <6a2247d9-461d-4b0a-b692-f0f3c0fab27f@eisentraut.org> <8f995a4c-64e3-40cd-bfed-06b54a280d36@illuminatedcomputing.com> <0832f18d-523f-4c15-acb0-338a785150c5@illuminatedcomputing.com> <5f0c25de-2c13-4fb5-a4df-a1e03c43cd14@illuminatedcomputin! g.com> <1b45f81d-4e99-4813-a2c6-72bf5fd80980@eisentraut.org> <3611540.1737518430@sss.pgh.pa.us> <9bb3eea7-820f-4932-92cb-cb564fc44caf@eisentraut.org> Content-Language: en-US From: Paul Jungwirth In-Reply-To: <9bb3eea7-820f-4932-92cb-cb564fc44caf@eisentraut.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/23/25 07:31, Peter Eisentraut wrote: > On 22.01.25 05:00, Tom Lane wrote: >> Peter Eisentraut writes: >>> I have committed the fix for foreign key NO ACTION (patch 0002, this did >>> not require patch 0001). >> >> That commit seems to be causing occasional buildfarm failures: >> >> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=indri&dt=2025-01-22%2001%3A29%3A35 >> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mylodon&dt=2025-01-22%2001%3A17%3A14 >> >> Both of these look like >> >> --- /Users/buildfarm/bf-data/HEAD/pgsql.build/src/test/regress/expected/without_overlaps.out >> 2025-01-21 20:29:36 >> +++ /Users/buildfarm/bf-data/HEAD/pgsql.build/src/test/regress/results/without_overlaps.out >> 2025-01-21 20:43:08 >> @@ -1792,8 +1792,6 @@ >>     SET valid_at = CASE WHEN lower(valid_at) = '2018-01-01' THEN daterange('2018-01-01', >> '2018-01-05') >>                         WHEN lower(valid_at) = '2018-02-01' THEN daterange('2018-01-05', >> '2018-03-01') END >>     WHERE id = '[6,7)'; >> -ERROR:  update or delete on table "temporal_rng" violates RESTRICT setting of foreign key >> constraint "temporal_fk_rng2rng_fk" on table "temporal_fk_rng2rng" >> -DETAIL:  Key (id, valid_at)=([6,7), [2018-01-01,2018-02-01)) is referenced from table >> "temporal_fk_rng2rng". >>   -- a PK update that fails because both are referenced (even before commit): >>   BEGIN; >>     ALTER TABLE temporal_fk_rng2rng >> >> ie, an expected error did not get thrown. > > I suspect the nested locking clauses in the new SQL query in the patch. I don't see anything else in > the patch that would possibly create this kind unstable behavior. I can't find a regression.diffs in the second link. Is there one? I can't tell if it's the same failure as in the first link as not. I ran installcheck-parallel on my own machine continuously over night and haven't been able to reproduce this yet. How many cases have appeared on the build farm? More than these two? And just to confirm: they are only since committing 1772d554b0? The strange thing is that the omitted error message is for a RESTRICT foreign key, and 1772d554b0 only changes behavior when is_no_action. That makes me think the bug is with the original temporal FK commit. But that has been running on the build farm for a long time, so probably not. Likewise, I don't see how it can be the nested locking, when that SQL isn't used for RESTRICT constraints. The infrequent failure made me suspect a memory error. It's hard to come up with explanations. What about caching the FK's query plan? Could the RESTRICT test ever reuse the constraint oid from the NO ACTION tests just above it? I'm pretty sure that's not supposed to happen, but if it used a plan generated from the NO ACTION SQL, it would exhibit the behavior we're seeing. It also makes sense why it only appeared after 1772d554b0. I'll dig into that hypothesis and let you know if I figure anything out. Yours, -- Paul ~{:-) pj@illuminatedcomputing.com