Re: [18] Policy on IMMUTABLE functions and Unicode updates

Isaac Morland <isaac.morland@gmail.com>

From: Isaac Morland <isaac.morland@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>, Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers@postgresql.org, Daniel Verite <daniel@manitou-mail.org>, Noah Misch <noah@leadboat.com>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Jeremy Schneider <schneider@ardentperf.com>
Date: 2024-07-22T17:54:21Z
Lists: pgsql-hackers
On Mon, 22 Jul 2024 at 13:51, Jeff Davis <pgsql@j-davis.com> wrote:


> > Are you proposing a switch that would make PostgreSQL error out if
> > somebody wants to use an unassigned code point?  That would be an
> > option.
>
> You can use a CHECK(UNICODE_ASSIGNED(t)) in version 17, and in version
> 18 I have a proposal here to make it a database-level option:
>

And if you define a domain over text with this check, you would effectively
have a type that works exactly like text except you can only store assigned
code points in it. Then use that instead of text everywhere (easy to audit
with a query over the system tables).