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 1qeQEi-006kfN-IT for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Sep 2023 01:24:40 +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 1qeQEh-005rde-Ai for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Sep 2023 01:24:39 +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 1qeQEh-005rdP-09 for pgsql-hackers@lists.postgresql.org; Fri, 08 Sep 2023 01:24:38 +0000 Received: from mail-ua1-x92e.google.com ([2607:f8b0:4864:20::92e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qeQEd-003mT4-At for pgsql-hackers@lists.postgresql.org; Fri, 08 Sep 2023 01:24:38 +0000 Received: by mail-ua1-x92e.google.com with SMTP id a1e0cc1a2514c-79a10807b4fso645788241.2 for ; Thu, 07 Sep 2023 18:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694136274; x=1694741074; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XPEId7dBSogrRxixZ/od88X4t9YmTG9AnmTTle3b2CQ=; b=dkfTlNgOUQ5j9hpS+biCgjsN3wKZYTa4Yo2RnNlYJ06c0guAxUrkZElbzA4Lco4r3L v/1UIW1rWDCXBaYIa/SDqQvWIPqHs11lFrWTIn6eHgwGNEvddWxLuuq7xS70uNaMV/Id qFb4hjYzWXfuXoJJ9ujCbQAPobw+U5tvBe0LIzzFdgdclRxliuWkYvR1LQ6wRREeOhni R/+npLOkr68Y29hsv9bJIzPMxxsmYGmzmVOHdSv95xfzSL9JDjomQI8Tvd7Noh6SfepJ kPtVbn4D36CihOA9Zmil+grnjXLYiky/l0O68C6Y6fjiRp/PC8CQQVMbqbQnmQD0CWFH SRxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694136274; x=1694741074; h=content-transfer-encoding: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=XPEId7dBSogrRxixZ/od88X4t9YmTG9AnmTTle3b2CQ=; b=B0IecQLvv7aepJFE/x5h5CutcIzFYsSp9mObzBdre821lDjSm7fUYanF5yDe0C5fZG kLSAKNhcsp+ZEVDCbgZ0bMWlaCSIMifEAhgB+6XuqwQ8si7fI8yiSNnM7FwKGCcRuxaq 9xTZIRBPTqgoWXn9/1KmsG9NwB5gSJbSnxSP9XPiktQqrhaLVddj9uDXvcBTyrI7G5E6 GfTew4v+qOH1jVSOGm3Z7NiAo25X2NBEZD96/RsSat4JSQUjN5TatCzbydONTVL6g+3U ij/eYtVrpbPAM9nMZIjJTkZOLm9qnOVgrecvLIDvhxY8iLQDssGomioEXrHQUV2Q7c79 80Iw== X-Gm-Message-State: AOJu0YxTDCYTgFLRRU6aMcSulDp9yHFIJ5gxsRVuSeyAJ0HCEsX0N4Mr 9b92d7Q4cG/TzqsMHOKUwCiSCmR62fhWg3YW828= X-Google-Smtp-Source: AGHT+IGZKdPcQX6X+lGIg0dvcbPjKEslCCyjazvnxwPAUebkuwaSzpxkz8rwQl6L2OsBEhhGFxCLkBEOt4fPJAaTiDU= X-Received: by 2002:a67:e990:0:b0:44e:a7bf:b9f6 with SMTP id b16-20020a67e990000000b0044ea7bfb9f6mr1317620vso.28.1694136273538; Thu, 07 Sep 2023 18:24:33 -0700 (PDT) MIME-Version: 1.0 References: <5650d77a-1d73-fd8d-4410-8e97dbeff572@illuminatedcomputing.com> <21964319-46e5-3e47-217b-6ac4169bdf13@enterprisedb.com> <27361388-f5ab-ea36-ea35-41d68a90e60d@illuminatedcomputing.com> <152e4c2c-36b4-bdc0-1b62-e9f9e8b68adc@enterprisedb.com> <251B44D1-D3E0-47E4-AB9D-4A848EDB495E@yesql.se> <1c674adf-4114-e8d8-cec7-ac10e2f424c7@enterprisedb.com> <831f17ba-ff36-1380-a475-a7cd2c65a89c@enterprisedb.com> <6f010a6e-8e20-658b-dc05-dc9033a694da@eisentraut.org> <7d44dade-ff31-5eef-80ac-78ed838066f6@postgresfriends.org> <88dadcc1-6652-ff7d-264d-73906a53dee9@illuminatedcomputing.com> In-Reply-To: <88dadcc1-6652-ff7d-264d-73906a53dee9@illuminatedcomputing.com> From: jian he Date: Fri, 8 Sep 2023 09:24:22 +0800 Message-ID: Subject: Re: SQL:2011 application time To: Paul Jungwirth Cc: Vik Fearing , Peter Eisentraut , Corey Huinker , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Sep 2, 2023 at 5:58=E2=80=AFAM Paul Jungwirth wrote: > > > I don't quite understand this part: > > >> Also, your implementation > >> requires at least one non-overlaps column, which also seems like a > >> confusing restriction. > > That's just a regular non-temporal constraint. Right? If I'm missing > something let me know. > for a range primary key, is it fine to expect it to be unique, not null and also not overlap? (i am not sure how hard to implement it). ----------------------------------------------------------------- quote from 7IWD2-02-Foundation-2011-12.pdf. 4.18.3.2 Unique constraints, page 97 of 1483. 4.18.3.2 Unique constraints In addition to the components of every table constraint descriptor, a unique constraint descriptor includes: =E2=80=94 An indication of whether it was defined with PRIMARY KEY or UNIQU= E. =E2=80=94 The names and positions of the unique columns specified in the =E2=80=94 If is specified, then the name o= f the period specified. If the table descriptor for base table T includes a unique constraint descriptor indicating that the unique constraint was defined with PRIMARY KEY, then the columns of that unique constraint constitute the primary key of T. A table that has a primary key cannot have a proper supertable. A unique constraint that does not include a on a table T is satisfied if and only if there do not exist two rows R1 and R2 of T such that R1 and R2 have the same non-null values in the unique columns. If a unique constraint UC on a table T includes a WOS, then let ATPN be the contained in WOS. UC is satisfied if and only if there do not exist two rows R1 and R2 of T such that R1 and R2 have the same non-null values in the unique columns and the ATPN period values of R1 and R2 overlap. In addition, if the unique constraint was defined with PRIMARY KEY, then it requires that none of the values in the specified column or columns be a null value. ----------------------------------------------------------------- based on the above, the unique constraint does not specify that the column list must be range type. UNIQUE (a, c WITHOUT OVERLAPS). Here column "a" can be a range type (that have overlap property) and can be not. In fact, many of your primary key, foreign key regess test using something like '[11,11]' (which make it more easy to understand), which in logic is a non-range usage. So UNIQUE (a, c WITHOUT OVERLAPS), column "a" be a non-range data type does make sense?