On Thu, 2025-06-05 at 10:12 +0200, Peter Eisentraut wrote:
> The reason we don't do it at parse time is that we don't have the
> information which functions care about collations, which is exactly
> what
> you are proposing here to add.
Currently, we have:
create table c(x text collate "C", y text collate "en_US");
insert into c values ('x', 'y');
select x < y from c; -- fails (runtime check)
select x || y from c; -- succeeds
Surely, "<" would be marked as ordering-sensitive, and we could move
the error to parse-time.
But what about UDFs? If we assume that all UDFs are ordering-sensitive
unless marked otherwise, then a user-defined version of "||" that
previously worked would now start failing, until they add the ordering-
insensitive mark.
We'd need some kind of migration path where we could retain the runtime
checks and disable the parse time checks until people have a chance to
add the right marks to their UDFs. Migration paths like that are not
great because they take several releases to work out, and we're never
quite sure when to finally remove the deprecated behavior.
If we make the opposite assumption, that none are ordering-sensitive
unless we mark them so, that would allow properly-marked functions to
fail at parse time, and the rest to fail at runtime. But this
assumption doesn't work as well for recording dependencies, because
we'd miss the dependencies for UDFs that aren't properly marked.
Thoughts?
Regards,
Jeff Davis