Postgres 15 -> 16 Migration Update (#5825)

* ICU-17235 fix(sql): add explicit casting to resolve Postgres 16 domain constraint changes

This migration updates the `wt_alias` and `wt_target_alias` domains to include explicit `::text` casting in their constraints. Postgres 16 enforces stricter domain checks, requiring explicit casts to ensure compatibility. These changes address upgrade issues by aligning the constraints with the stricter evaluation rules.

* Add Comment To Old Constraints
pull/5848/head
Ryan Derr 10 months ago committed by GitHub
parent 915be558d2
commit 7040374b6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,6 +3,9 @@
begin;
-- Constraints wt_alias_too_short, wt_alias_no_suround_spaces, and wt_target_alias_too_long
-- have been updated in migration 96/01
-- wt_alias defines a type for alias values
create domain wt_alias as citext
constraint wt_alias_too_short

@ -0,0 +1,21 @@
-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1
begin;
-- Modify the wt_alias domain to include explicit casts in its constraints
alter domain wt_alias drop constraint if exists wt_alias_too_short;
alter domain wt_alias drop constraint if exists wt_alias_no_suround_spaces;
alter domain wt_alias add constraint wt_alias_too_short
check (length(trim(both from value::text)) > 0);
alter domain wt_alias add constraint wt_alias_no_suround_spaces
check (trim(both from value::text) = value::text);
-- Modify the wt_target_alias domain to include explicit casts in its constraints
alter domain wt_target_alias drop constraint if exists wt_target_alias_too_long;
alter domain wt_target_alias add constraint wt_target_alias_too_long
check (length(trim(both from value::text)) < 254);
commit;
Loading…
Cancel
Save