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 1s6PTk-00Bn1U-FB for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 06:48:08 +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 1s6PTi-00FXZi-Qq for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 06:48:07 +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 1s6PTY-00FQwD-Kh for pgsql-hackers@lists.postgresql.org; Mon, 13 May 2024 06:47:57 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s6Nhz-000jQi-GU for pgsql-hackers@lists.postgresql.org; Mon, 13 May 2024 04:55:00 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5ce6b5e3c4eso2244914a12.2 for ; Sun, 12 May 2024 21:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20230601.gappssmtp.com; s=20230601; t=1715576076; x=1716180876; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=37KhmQE3jUFPDnWJfqwbKJEuoi4ezTrqfv4gkU+QfkI=; b=h4phP9RzcFjrS7iJMS3rJYo1qTpikqyQ+ZsFrdIOvw3E9K6KS+bjbbmHyL9HCuLxvH ZgEEI+HRWlmGK+wVT3ODVVK6126zNt/gwPnnbYOOZVNaqD5DOlUyaNFaKVEZInfIi0OL BIQ/d76YfN1wuU7SRTsG/pCqRQ9rpSoqdrJmhqdYhs8ScKfYyxqNRzmZNVPH1suMTyty RwTteFArVahXtS839kKkMqGh3BP0+3o6l4eU4KrW/uwCF062BMBFKRVZFxwLmpi/RrH6 kMsLE37hNqU6GNSWb7KPz3EclhYmb9OnaBJe+8g0Q6gUxydrb6rJnb7ATqQOVM8R1KYu uNBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715576076; x=1716180876; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=37KhmQE3jUFPDnWJfqwbKJEuoi4ezTrqfv4gkU+QfkI=; b=deISgATJXO0EKzt3PNs87sA+0nhGn+TZAcrd8KgtH/qWezP1qrGSh2AsTKR5pgDL21 9rno2FuEoAlUi0gh/k1nAFUBtANRpSyfcYv6//EPFRkYMoTvN8Mp80wNmqaxkD2nbyZN AuzmBXjQakosJlidhvwnxAzuxk/TZ6q8vYEuSraeV3SZx9uqS4HWJIZlu7VtRRA1l49O qiq0xN22FKoC9PaCfRYxHTSFlrsBF8tpBkJGjKxO7aOWb/q0eSnmscWt8cAq/TFcBCP6 ZQy890ddo8Jy0Ba8wXBn6js3o+B/Zv0dO94hHSC0EWiRvptD/docc6MaFRm5kUrfbgwT /xEA== X-Forwarded-Encrypted: i=1; AJvYcCVR2dk4KMxH4fMmqcs1vzWiVMd2l1rkPVYS+P5Gi79b+YceeKxFMEqcARKjS7SLFU/ftWT9epd3GlCYUDCWxNNN2UJ3wiCS3zySuF7mA4rCMOE+ X-Gm-Message-State: AOJu0Yy1JHvoeW8TicvGGNIZBde4mwUIzZOTwgwYVp20yQ3obNr/5pJx TgCn2o6SxLtpCBg8vQZxZC5qe98akJhsyQFRNV7HJHY/dM5T2WmbbCqaipybF8w= X-Google-Smtp-Source: AGHT+IF/lPIPo26baaEAfCZF+QczUUwJ+QLP3ek4UmBKuuazsllQl0GYXqvybghmXC620ddoznfPbA== X-Received: by 2002:a17:902:d48f:b0:1eb:5a92:cabf with SMTP id d9443c01a7336-1ef43e3484cmr110362085ad.41.1715576076088; Sun, 12 May 2024 21:54:36 -0700 (PDT) Received: from [192.168.2.139] ([50.39.255.79]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1ef0b9d47e0sm69931975ad.5.2024.05.12.21.54.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 May 2024 21:54:35 -0700 (PDT) Message-ID: Date: Sun, 12 May 2024 21:54:34 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SQL:2011 application time From: Paul Jungwirth To: Matthias van de Meent Cc: Peter Eisentraut , Robert Haas , jian he , PostgreSQL Hackers References: <1edb3b79-a4bc-43b1-80aa-2e090472fe32@eisentraut.org> <47550967-260b-4180-9791-b224859fe63e@illuminatedcomputing.com> <1b2ab118-82c1-4e79-a094-04dab382e2c4@illuminatedcomputing.com> <3775839b-3f0f-4c8a-ac03-a253222e6a4b@illuminatedcomputing.com> <731ef81e-d4c3-41c6-ba8f-f6131f4f6407@eisentraut.org> <1426589a-83cb-4a89-bf40-713970c07e63@illuminatedcomputing.com> <5aefa87e-ba20-4a34-88aa-233255643c1b@illuminatedcomputing.com> <37d3137d-6bdd-4192-9f8f-da35974aa693@illuminatedcomputing.com> Content-Language: en-US In-Reply-To: <37d3137d-6bdd-4192-9f8f-da35974aa693@illuminatedcomputing.com> 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 5/12/24 08:51, Paul Jungwirth wrote: > On 5/12/24 05:55, Matthias van de Meent wrote: >>>   > pg=# CREATE UNIQUE INDEX ON temporal_testing USING gist (id, valid_during); >>>   > ERROR:  access method "gist" does not support unique indexes >>> >>> To me that error message seems correct. The programmer hasn't said anything about the special >>> temporal behavior they are looking for. >> >> But I showed that I had a GIST index that does have the indisunique >> flag set, which shows that GIST does support indexes with unique >> semantics. >> >> That I can't use CREATE UNIQUE INDEX to create such an index doesn't >> mean the feature doesn't exist, which is what the error message >> implies. > > True, the error message is not really telling the truth anymore. I do think most people who hit this > error are not thinking about temporal constraints at all though, and for non-temporal constraints it > is still true. It's also true for CREATE INDEX, since WITHOUT OVERLAPS is only available on the > *constraint*. So how about adding a hint, something like this?: > > ERROR:  access method "gist" does not support unique indexes > HINT: To create a unique constraint with non-overlap behavior, use ADD CONSTRAINT ... WITHOUT OVERLAPS. I thought a little more about eventually implementing WITHOUT OVERLAPS support for CREATE INDEX, and how it relates to this error message in particular. Even when that is done, it will still depend on the stratnum support function for the keys' opclasses, so the GiST AM itself will still have false amcanunique, I believe. Probably the existing error message is still the right one. The hint won't need to mention ADD CONSTRAINT anymore. It should still point users to WITHOUT OVERLAPS, and possibly the stratnum support function too. I think what we are doing for v17 is all compatible with that plan. Yours, -- Paul ~{:-) pj@illuminatedcomputing.com