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 1r9UvN-00049R-TI for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Dec 2023 18:41:10 +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 1r9UvM-00B7wS-3B for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Dec 2023 18:41:08 +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 1r9UvL-00B7wK-Pr for pgsql-hackers@lists.postgresql.org; Sat, 02 Dec 2023 18:41:07 +0000 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r9UvI-009lAs-HT for pgsql-hackers@lists.postgresql.org; Sat, 02 Dec 2023 18:41:06 +0000 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-5d762c9fd90so4607817b3.0 for ; Sat, 02 Dec 2023 10:41:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20230601.gappssmtp.com; s=20230601; t=1701542462; x=1702147262; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=gbQNtK/Fb1caY30dsdf1UGD7k8BlZ08UMI/HNmNcp2c=; b=e0sYmQFG1LJEJGTCgPBPzay4ZZBTMG+DgGtYUduEnQ6k01oPHgVcEgz3A8x8368/mQ mdGRPtNvOaZ+MSGNyV+RWv4M1QO7esov9qeFlA+FWeDGNhFH35+/4sT76BrCUEUIdbum p9Rf72H1uEI5qOIAPtNM+VEVM0uqGQ5hwCQWvj8WV2MMn+/qKbCsVu2Bp/QjWJWzQPIX 4JzQlX/HW/5517i2BK9JW+fKR6ifcwxYgEajWUBi9kfy7Dsr6/r83mU+CPpJF6gv/njn /di+A0DuWVZHFmlCPCWtVdnenf8rJ+Pwarj5jSCtV8lfKu55GsV/DqQmSMlW75AXMcxo 2jfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701542462; x=1702147262; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gbQNtK/Fb1caY30dsdf1UGD7k8BlZ08UMI/HNmNcp2c=; b=wQmBHREhY/Nhp6LFME2Uy3uQ7xzr7ka3pLKL1PVn8TKU+Y0hh4zxXlCoCiXRCSIGPQ edMmp6+lPCRCRoStLVm3UciGOLpKVki00F7J9abhFvnUvQnxMEGw4ihjGXV8u7AXRjZX tgCF377nCWRbLKDWPwjAScVxiCbjppdq0eyHdz/yigqrTIjiNAD/RLtRfsknRjXNnv4J Ay0k+I38rbGYqDt3iLfWWA22NwCTrOZQOfcpzxe8qM0WJq3PlQRTxpLT8Lf1D6CabkOa wlKpAaqMi/vCFKnXpvWZAz3tWbjykQQPV58z1dNmVboGsfvePzv3yhlY5h2hx03QBZ+M NXUw== X-Gm-Message-State: AOJu0Yz0Y+6WAlJKvRPW8WHjdjlRVKMmEqfeF913pOyOHFmvCTmkWs2t nALrsO+ulFau4uPDK313vbGW7g== X-Google-Smtp-Source: AGHT+IGwoEgGTxCR/215GSWNt1u3z4i6wSpujsPUgWVtTeQ7v3EqXtx+Y84bg6pzv6kMKEB4Ql24cA== X-Received: by 2002:a81:a082:0:b0:5d7:1940:b396 with SMTP id x124-20020a81a082000000b005d71940b396mr1549223ywg.98.1701542462452; Sat, 02 Dec 2023 10:41:02 -0800 (PST) Received: from [192.168.2.139] ([50.53.98.191]) by smtp.googlemail.com with ESMTPSA id ay7-20020a1709028b8700b001acae9734c0sm5425832plb.266.2023.12.02.10.41.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 Dec 2023 10:41:01 -0800 (PST) Message-ID: Date: Sat, 2 Dec 2023 10:41:01 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SQL:2011 application time Content-Language: en-US To: Peter Eisentraut , jian he Cc: PostgreSQL Hackers References: <5a16a59a-d497-7d72-07aa-0afc09d5193a@illuminatedcomputing.com> <2d9740ad-3bb7-473c-8441-344351caa8ee@illuminatedcomputing.com> <596fefdd-6202-4228-b7c6-f240b1cbe06e@eisentraut.org> From: Paul Jungwirth In-Reply-To: <596fefdd-6202-4228-b7c6-f240b1cbe06e@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 Thu, Nov 23, 2023 at 1:08 AM Peter Eisentraut wrote: > After further thought, I think the right solution is to change > btree_gist (and probably also btree_gin) to use the common RT* strategy > numbers. Okay. That will mean bumping the version of btree_gist, and you must be running that version to use the new temporal features, or you will get silly results. Right? Is there a way to protect users against that and communicate they need to upgrade the extension? This also means temporal features may not work in custom GIST opclasses. What we're saying is they must have an appropriate operator for RTEqualStrategyNumber (18) and RTOverlapStrategyNumber (3). Equal matters for the scalar key part(s), overlap for the range part. So equal is more likely to be an issue, but overlap matters if we want to support non-ranges (which I'd say is worth doing). Also if they get it wrong, we won't really have any way to report an error. I did some research on other extensions in contrib, as well as PostGIS. Here is what I found: ## btree_gin: 3 is = 18 is undefined same for all types: macaddr8, int2, int4, int8, float4, float8, oid, timestamp, timestamptz, time, timetz, date, interval, inet, cidr, text, varchar, char, bytea, bit, varbit, numeric, anyenum, uuid, name, bool, bpchar ## cube 3 is && 18 is <=> ## intarray 3 is && 18 is undefined ## ltree 3 is = 18 is undefined ## hstore 3 and 18 are undefined ## seg 3 is && 18 is undefined ## postgis: geometry 3 is && 18 is undefined ## postgis: geometry_nd 3 is &&& 18 is undefined I thought about looking through pgxn for more, but I haven't yet. I may still do that. But already it seems like there is not much consistency. So what do you think of this idea instead?: We could add a new (optional) support function to GiST that translates "well-known" strategy numbers into the opclass's own strategy numbers. This would be support function 12. Then we can say translateStrategyNumber(RTEqualStrategyNumber) and look up the operator with the result. There is not a performance hit, because we do this for the DDL command (create pk/uq/fk), then store the operator in the index/constraint. If you don't provide this new support function, then creating the pk/uq/fk fails with a hint about what you can do to make it work. This approach means we don't change the rules about GiST opclasses: you can still use the stranums how you like. This function would also let me support non-range "temporal" foreign keys, where I'll need to build queries with && and maybe other operators. What do you think? -- Paul ~{:-) pj@illuminatedcomputing.com