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 1sQBRf-008LO5-Ig for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jul 2024 19:51:43 +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 1sQBRe-005lvm-25 for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jul 2024 19:51:42 +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 1sQBRd-005lve-GT for pgsql-hackers@lists.postgresql.org; Sat, 06 Jul 2024 19:51:41 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sQBRW-000m3R-7Y for pgsql-hackers@postgresql.org; Sat, 06 Jul 2024 19:51:40 +0000 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3d561d685e7so1825203b6e.1 for ; Sat, 06 Jul 2024 12:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1720295492; x=1720900292; darn=postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=c6IUC68moBWdWK68VPQmNeaNg2gYw3Fs3X067MYF5ho=; b=gl6Pk2NR+cLZ993dJbEj+bqi3//p7BQA0gvmxYbDo8zRM3V46544Zd1D+jDve5I4sQ YDwXKkxdv0cPvVwGgrf9DTga6K0L6f0tFqojTaIdgBxFsn/BCDURw/tyIgHzZ8CaYSZZ ISAtsZwPZp45AMaB3GpbuUm6K8XjipkP/LKMI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720295492; x=1720900292; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c6IUC68moBWdWK68VPQmNeaNg2gYw3Fs3X067MYF5ho=; b=Syp4j9n+CCqOo7Q0cYFKcA9RRWhDLSJ1e5zz7wSTxt4e4UfuOo/VXghRCSiFmPTJ6R 0XZFD9pPBtjNZHCZuHnyRkkYv0icKqIb+kDoSMduQquvo4YvbgeucBthJqKqzyD1Cb/z 7RxmYsk7teeZnkLyCU4XBlq7UswaW9IwcxUbFZ8jCzyuXxsNLSCYkhjeeh65AZ9RSYIO 2W3D96QeRqHNc61ktwJ8bSJVQB/EOhMGKdg/ihMuKWkR8gNSoFf344wkO0WV6Dqlt13U vXSc/MvMwa2TUdWBqs+kUzca/aCfNgpGhNfctCIVEt1DkB8HO0eusUh6l4S7iCRTUMhv WUFA== X-Forwarded-Encrypted: i=1; AJvYcCWXTI3bleXXMmCxwlfvRFKEDspIUoEttNcp5VxpStD/H9/KZhXXmrx5WZgvL2fcb5vh3Tp2V1emC9YD1+HOl5uVqdGiR+wXd5pabMDM X-Gm-Message-State: AOJu0YzvNMnTk6gvwWm3AvBmgF4qSmwPicuxN17OCtEBhLG12XsVbwOM 9TkA9D2/ZlbDrLHHBxV25fT1OnUXPem1V3EezQmJYk3fMN/2MPPbHZlzNtfVnQ== X-Google-Smtp-Source: AGHT+IEkV7bi/M/UHb9lAJlDlwwPN+NgSf78l+dQzfosAXEe4T66iHQuwUEJWIR0ybSsAR3q340ZwQ== X-Received: by 2002:a05:6808:210e:b0:3d5:47bc:14e2 with SMTP id 5614622812f47-3d914c8199dmr9875211b6e.31.1720295491981; Sat, 06 Jul 2024 12:51:31 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-708044af3b0sm16626393b3a.175.2024.07.06.12.51.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Jul 2024 12:51:31 -0700 (PDT) Date: Sat, 6 Jul 2024 12:51:29 -0700 From: Noah Misch To: Jeff Davis Cc: Peter Eisentraut , Daniel Verite , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Subject: Re: Built-in CTYPE provider Message-ID: <20240706195129.fd@rfd.leadboat.com> References: <20240629220857.fb.nmisch@google.com> <1ecfeb4d2b1b7f119fa917d3052a3aecfaf4f425.camel@j-davis.com> <20240701230352.2c.nmisch@google.com> <20240702165145.af.nmisch@google.com> <1200e97b-3a52-43c6-8b16-20cf45f58249@eisentraut.org> <20240702230333.8d.nmisch@google.com> <20240704212641.c4.nmisch@google.com> <1d178eb1bbd61da1bcfe4a11d6545e9cdcede1d1.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1d178eb1bbd61da1bcfe4a11d6545e9cdcede1d1.camel@j-davis.com> User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jul 05, 2024 at 02:38:45PM -0700, Jeff Davis wrote: > On Thu, 2024-07-04 at 14:26 -0700, Noah Misch wrote: > > I think you're saying that if some Unicode update changes the results > > of a > > STABLE function but does not change the result of any IMMUTABLE > > function, we > > may as well import that update.  Is that about right?  If so, I > > agree. > > If you are proposing that Unicode updates should not be performed if > they affect the results of any IMMUTABLE function, then that's a new > policy. > > For instance, the results of NORMALIZE() changed from PG15 to PG16 due > to commit 1091b48cd7: > > SELECT NORMALIZE(U&'\+01E030',nfkc)::bytea; > > Version 15: \xf09e80b0 > > Version 16: \xd0b0 As a released feature, NORMALIZE() has a different set of remedies to choose from, and I'm not proposing one. I may have sidetracked this thread by talking about remedies without an agreement that pg_c_utf8 has a problem. My question for the PostgreSQL maintainers is this: textregexeq(... COLLATE pg_c_utf8, '[[:alpha:]]') and lower(), despite being IMMUTABLE, will change behavior in some major releases. pg_upgrade does not have a concept of IMMUTABLE functions changing, so index scans will return wrong query results after upgrade. Is it okay for v17 to release a pg_c_utf8 planned to behave that way when upgrading v17 to v18+? If the answer is yes, the open item closes. If the answer is no, determining the remedy can come next. Lest concrete details help anyone reading, here are some affected objects: CREATE TABLE t (s text COLLATE pg_c_utf8); INSERT INTO t VALUES (U&'\+00a7dc'), (U&'\+001dd3'); CREATE INDEX iexpr ON t ((lower(s))); CREATE INDEX ipred ON t (s) WHERE s ~ '[[:alpha:]]'; v17 can simulate the Unicode aspect of a v18 upgrade, like this: sed -i 's/^UNICODE_VERSION.*/UNICODE_VERSION = 16.0.0/' src/Makefile.global.in # ignore test failures (your ICU likely doesn't have the Unicode 16.0.0 draft) make -C src/common/unicode update-unicode make make install pg_ctl restart Behavior after that: -- 2 rows w/ seq scan, 0 rows w/ index scan SELECT 1 FROM t WHERE s ~ '[[:alpha:]]'; SET enable_seqscan = off; SELECT 1 FROM t WHERE s ~ '[[:alpha:]]'; -- ERROR: heap tuple (0,1) from table "t" lacks matching index tuple within index "iexpr" SELECT bt_index_parent_check('iexpr', heapallindexed => true); -- ERROR: heap tuple (0,1) from table "t" lacks matching index tuple within index "ipred" SELECT bt_index_parent_check('ipred', heapallindexed => true);