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 1tv6f7-0008Sa-Pw for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Mar 2025 03:33:42 +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 1tv6f6-00GFTL-4z for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Mar 2025 03:33:40 +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 1tv6f5-00GFSD-Qq for pgsql-hackers@lists.postgresql.org; Thu, 20 Mar 2025 03:33:39 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tv6f4-0003DK-1E for pgsql-hackers@lists.postgresql.org; Thu, 20 Mar 2025 03:33:38 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-223fd89d036so3886575ad.1 for ; Wed, 19 Mar 2025 20:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20230601.gappssmtp.com; s=20230601; t=1742441617; x=1743046417; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ZmFhUQf2+Dgvr6pp4hx+dYLAb6TgJDslskWQ08l7Mzo=; b=mq7qLdb5zcKrU9tn0eGm5I1tC61xJ47vWLlJigBbRf2ac7UqfxabKEEqXvkhk4OGl4 L5yewUL7KUtkOObCeqG/U8hY7wZX3imQOADzccVkbzohBVVGr5pMbjdkyYXmJCNyBF9d U3Bv9WPH9lBYG26oy8ORIOL8tPPjeYS+kDE/eCDAK7gvtSzoqHMqohN4NU8vT56c+px2 IlczyatlrS4WjSNYBK+sWMWZZ7G/Q8m3osrDAPuY03f7WS//oCIJlCDypg26aoADtGzt m5AY4nnk5Erj1QZmpPl4Fw+yYAOr9r78bdzmtH2jYawQPYrSbEO1BAZmv/xhOYVmJv9G dzkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742441617; x=1743046417; h=content-transfer-encoding:in-reply-to:content-language:from :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=ZmFhUQf2+Dgvr6pp4hx+dYLAb6TgJDslskWQ08l7Mzo=; b=QE9AVt3C+2Rrrwn34ACZN4++he4xR38JHKVM0r8WJevdQKBJGGHrKVftIEj8bN0YCh H0f4jAhT8Qes8KgGoDy6+TdQnAMwDZ64GkvB2Z+hHuVaW1aap/fMMo0Epx93j7k0MiZx bQGnb46ahg+AEfDZuxbpVhftlZYVstvJFbHbihbWs0TjFITfspzxu2zvd0OLx2c3g8eN 9k0GAS975PKWai8I2tm+2dsO50fxOjYpXUJUmbuYYLzRi1+DCW4W+8Z5bKuD9n9xSAy1 NWE9Oq/k3Ty7N3pbeEsh3FjH2SPh8EgEIUutnjl+O65aK2boDIKmLO4IpgI3WT90u7uw ADJg== X-Forwarded-Encrypted: i=1; AJvYcCUlq7m5pNz/LuEt5EOzr4otTres4RF8tIGdNGetm9tbNa+kO1YzbVM14MTZrrrdimqNdjK5evmivUkZOKxj@lists.postgresql.org X-Gm-Message-State: AOJu0Yya0/z3CWshaWwdeE1Qxw6rqEj46lxyOq9Q8SFeE3+lbYDX8UjL HPlP3rtUq5c+8fif2umb/Nxbo1ey4R6aJ8ByDgD6D9QBp+a8Xc3l5eaw0m3onuM= X-Gm-Gg: ASbGncv/ZYI50AnVS0haz6rnWThU2Hf9xxQIB4LPCk+0RWOxwuHuJFjaG3iwL9ecpPK Ca4+ZdcaJBKaH0IjSnN3XgdX/j6kAkrqoPNGQcn70LyydLHvMgAn6O5n3pHacbXwZmZ15nSrW8h WErNA4WNpQp3ZIuVC9kDsWdrRAPGMa1xMVnBFNgAEqWklMfFOCuC7ARikQLDUN1zog26cs7O8o1 UAtpXcxDUZAFdYCA4WgcznsqFP1R7EsImHtavQyBdwa4kqSltb37I+CRQ+BQOl8ZB2wylg5nhxA +kVme/D/EtV8w4yCYCYH5A9tUNgQu3P8/gvB9EvHVwMqL3RmmBnKS7r5Vg== X-Google-Smtp-Source: AGHT+IF+dRXnUn4XthogTwYfYiJO63oTV7Rv89M3Pm7j/XuUj3pqSaDFEF2toNxUp39G7VkFuZIsmQ== X-Received: by 2002:a17:902:f70c:b0:215:9bc2:42ec with SMTP id d9443c01a7336-22649cb4d2emr76143205ad.47.1742441617516; Wed, 19 Mar 2025 20:33:37 -0700 (PDT) Received: from [192.168.2.139] ([50.39.255.79]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-22663c689d9sm3174725ad.183.2025.03.19.20.33.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Mar 2025 20:33:36 -0700 (PDT) Message-ID: <472e52a1-1960-49e3-a029-f271ba2670d8@illuminatedcomputing.com> Date: Wed, 19 Mar 2025 20:33:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SQL:2011 application time To: Peter Eisentraut Cc: jian he , PostgreSQL Hackers , vignesh C References: <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@illuminatedcomputing.com> <1b45f81d-4e99-4813-a2c6-72bf5fd80980@eisentraut.org> <3e061027-781d-42c1-b6e8-bafbf3b51033@eisentraut.org> <3b33690e-0d67-47a5-8424-93ac1fed4c26@eisentraut.org> <1085d8a3-17a7-4639-afd2-bd6dfa09713d@illuminatedcomputing.com> <22c4dd72-66fa-4f76-95f2-757d754e2aad@eisentraut.org> From: Paul Jungwirth Content-Language: en-US In-Reply-To: <22c4dd72-66fa-4f76-95f2-757d754e2aad@eisentraut.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/3/25 02:05, Peter Eisentraut wrote: > In the theory of the SQL standard, executing referential actions and checking the foreign-key > constraint are two separate steps. So it kind of goes like this: > > 1. run command > 2. run any referential actions > 3. check that foreign key is still satisfied > > This is why the default referential action is called "NO ACTION": It just skips the step 2. But it > still does step 3. > > This means that under RESTRICT and with my interpretation, the check for a RESTRICT violation in > step 2 can "ignore" the period part, but the step 3 still has to observe the period part. > > In the implementation, these steps are mostly combined into one trigger function, so it might be a > bit tricky to untangle them. I understand that there are those separate steps. But it still doesn't make sense for RESTRICT to ignore the temporal part of the key. Actually, talking about "actions" reminds me of another reason: the effect of CASCASE/SET NULL/SET DEFAULT actions should also be limited to only the part of history that was updated/deleted in the referenced row. (This is why their implementation depends on FOR PORTION OF.) Otherwise a temporal CASCADE/SET NULL/SET DEFAULT would wreck havoc on your data. But if that's how these other actions behave, shouldn't RESTRICT behave the same way? Again, it's not clear why anyone would want a temporal foreign key that ignores its temporal attribute. And as I explained before, I don't think that's what a careful read of the standard says. Yours, -- Paul ~{:-) pj@illuminatedcomputing.com