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 1s9UDD-002e2Y-F5 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 May 2024 18:27:48 +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 1s9UDD-00Bswq-EM for pgsql-hackers@arkaria.postgresql.org; Tue, 21 May 2024 18:27:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9UDD-00Bswi-4i for pgsql-hackers@lists.postgresql.org; Tue, 21 May 2024 18:27:47 +0000 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s9UDA-0004nu-7P for pgsql-hackers@lists.postgresql.org; Tue, 21 May 2024 18:27:46 +0000 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-5b2768410d3so2604258eaf.2 for ; Tue, 21 May 2024 11:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716316062; x=1716920862; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2bJCQGxd9Sg1/F5y3IOWyJoxhWz55WrXQ+C9YUWFoHU=; b=dWQlTRFqVsJbImwy/JMPIiuumKEjrm7ZwRE3G44qUdjfKZ0uJu5exZQ4JYxHgIJk9w D54ZM8rJNjHwpgkP/ndhaAHbTf8Qzdpme5nE+TlhP+q2lT02JA6xFFNGZ0KsQ+q3Y3C+ gcrBMtvA3xLjPEb4/+L/SGodHFsCCZyrINqy9gWxOe7YNza1g1CgYesVO5LqgUk0S18p qy4D6z7ShXm3QHUBDVCA6Q+Zc5g1ILOW9ZghqlEfyux84OcNu9whg3msLOSNP/LsMzxc AQUyx9l+1OmwjDxsMeP0FsXjVUpNdS51HEcwPwHEUNU4rAqojhg+frpv1aD5WnuSXEra lF2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716316062; x=1716920862; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2bJCQGxd9Sg1/F5y3IOWyJoxhWz55WrXQ+C9YUWFoHU=; b=VCSpJEdzvbCDrxpWovrqnMo/QVFRsVM17GyEBtJ2jzsD36ThPAils1lZUxcSAgv7Cq 9bMGuBWf2xwknjDX49fRc1zrT8cXxWz8+JPadczhynhOnPD5Kn/pg8qcUwerlvtWGK1e OUvWOs5XeHJ4bN5SnybXgvg1sawT8AP4R65bC1rBK8t3MOwZdx0ieqSnbf3ao8Z5BZAd 0c4FxjetdDAzplhBo9QsNunfhguttQOC2wiu7rtmqbQ6wajcblGnhYR/3wHHWx3rq7xw xeujP4X6DqjuPrnvOEIuZD/TQeh6aygzU44PIqpGONjGoxZJQ+/Jr+TZTmV0+HRpH5S9 wXRA== X-Forwarded-Encrypted: i=1; AJvYcCVeXWoWyx4/ldmeWmifaqk3ADty5LMpnlFbwYU53gH8vAYaokrsnMtZB6RbnhkQOcKoeJ20JJC5DHILlTMrFu7BQW5m9HjZFgzkzxE9pOc/qsgk X-Gm-Message-State: AOJu0YwNAFyvtKwJ9iQ+vL4hEwU3YaolpfHgwN6xT0hLWbtzhDFVY/s2 ZeEZdMo2tPLhDRwcaf3W1UW1KLFmPEYCw91Z2HGb+1cPb5Xb4+mrSV7md5DHucvjK2q0gv5L66Y pQUki0zX+JYmc+pjR3OS8/g20Zm8= X-Google-Smtp-Source: AGHT+IFYbOJeSFRbQuc2b/zx0l4GFPgohw0k1XvixdT/p5sQr8vjr71iNer6BX5muJtbNe0eLxLtWNgQMgg5aszufEw= X-Received: by 2002:a05:6358:27a3:b0:18f:81e1:c4e5 with SMTP id e5c5f4694b2df-193bb3f8d2dmr2841275255d.5.1716316061890; Tue, 21 May 2024 11:27:41 -0700 (PDT) MIME-Version: 1.0 References: <85dd3ad0-fa79-46e8-a08b-c426c76825f3@eisentraut.org> <49c07eac-18ec-4aff-929c-e81b87df1092@eisentraut.org> <1edb3b79-a4bc-43b1-80aa-2e090472fe32@eisentraut.org> <47550967-260b-4180-9791-b224859fe63e@illuminatedcomputing.com> <64c2b2ab-7ce9-475e-ac59-3bfec528bada@eisentraut.org> <58b6687fe9de002e4c862a412719e4f918bad987.camel@j-davis.com> In-Reply-To: From: Isaac Morland Date: Tue, 21 May 2024 14:27:29 -0400 Message-ID: Subject: Re: SQL:2011 application time To: Robert Haas Cc: Jeff Davis , Peter Eisentraut , Paul Jungwirth , jian he , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000003107ff0618faf924" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003107ff0618faf924 Content-Type: text/plain; charset="UTF-8" On Tue, 21 May 2024 at 13:57, Robert Haas wrote: What I think is less clear is what that means for temporal primary > keys. As Paul pointed out upthread, in every other case, a temporal > primary key is at least as unique as a regular primary key, but in > this case, it isn't. And someone might reasonably think that a > temporal primary key should exclude empty ranges just as all primary > keys exclude nulls. Or they might think the opposite. > Fascinating. I think you're absolutely right that it's clear that two empty intervals don't conflict. If somebody wants to claim two intervals conflict, they need to point to at least one instant in time that is common between them. But a major point of a primary key, it seems to me, is that it uniquely identifies a row. If items are identified by a time range, non-overlapping or not, then the empty range can only identify one item (per value of whatever other columns are in the primary key). I think for a unique key the non-overlapping restriction has to be considered an additional restriction on top of the usual uniqueness restriction. I suspect in many applications there will be a non-empty constraint; for example, it seems quite reasonable to me for a meeting booking system to forbid empty meetings. But when they are allowed they should behave in the mathematically appropriate way. --0000000000003107ff0618faf924 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, 21 May 2024 at 13:57, Robert Haas= <robertmhaas@gmail.com>= wrote:

What I think is less clear is what that means for temporal primary
keys. As Paul pointed out upthread, in every other case, a temporal
primary key is at least as unique as a regular primary key, but in
this case, it isn't. And someone might reasonably think that a
temporal primary key should exclude empty ranges just as all primary
keys exclude nulls. Or they might think the opposite.=C2=A0

Fascinating. I think you're absolutely right that = it's clear that two empty intervals don't conflict. If somebody wan= ts to claim two intervals conflict, they need to point to at least one inst= ant in time that is common between them.

But a maj= or point of a primary key, it seems to me, is that it uniquely identifies a= row. If items are identified by a time range, non-overlapping or not, then= the empty range can only identify=C2=A0one item (per value of whatever oth= er columns are in the primary key). I think for a unique key the non-overla= pping restriction has to be considered an additional restriction on top of = the usual uniqueness restriction.

I suspect in man= y applications there will be a non-empty constraint; for example, it seems = quite reasonable to me for a meeting booking system to forbid empty meeting= s. But when they are allowed they should behave in the mathematically appro= priate way.
--0000000000003107ff0618faf924--