Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't upgrade postgresql from 15 to 16 #5432

Open
yongzhang opened this issue Jan 13, 2025 · 2 comments
Open

Can't upgrade postgresql from 15 to 16 #5432

yongzhang opened this issue Jan 13, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@yongzhang
Copy link
Contributor

Describe the bug
It seems weird to raise an issue for pg upgrades here, but I'm not sure if it's related to boundary itself, so just asking in case anyone having the same issue.

Boundary version: v0.18.2

To Reproduce
Steps to reproduce the behavior:

  1. Upgrade aws postgresql from 15.4 to 16.4
  2. See error:
pg_restore: error: could not execute query: ERROR: function pg_catalog.btrim(public.citext) does not exist
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Command was:
-- For binary upgrade, must preserve pg_type oid
SELECT pg_catalog.binary_upgrade_set_next_pg_type_oid('380799'::pg_catalog.oid);
-- For binary upgrade, must preserve pg_type array oid
SELECT pg_catalog.binary_upgrade_set_next_array_pg_type_oid('380798'::pg_catalog.oid);
CREATE DOMAIN "public"."wt_alias" AS "public"."citext"
CONSTRAINT "wt_alias_no_suround_spaces" CHECK ((TRIM(BOTH FROM VALUE) = (VALUE)::"text"))
CONSTRAINT "wt_alias_too_short" CHECK (("length"(TRIM(BOTH FROM VALUE)) > 0));

I have a few more pg clusters upgraded from 15.4 to 16.4, all succeeded except this one, and seems boundary is the only one requires citext.

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

@yongzhang yongzhang added the bug Something isn't working label Jan 13, 2025
@yongzhang
Copy link
Contributor Author

yongzhang commented Jan 13, 2025

I did a test, if I run sql below before pg upgrading:

ALTER DOMAIN public.wt_alias DROP CONSTRAINT wt_alias_no_suround_spaces;
ALTER DOMAIN public.wt_alias DROP CONSTRAINT wt_alias_too_short;
ALTER DOMAIN public.wt_alias ADD CONSTRAINT wt_alias_no_suround_spaces CHECK ((TRIM(BOTH FROM VALUE::text) = (VALUE)::text));
ALTER DOMAIN public.wt_alias ADD CONSTRAINT wt_alias_too_short CHECK (("length"(TRIM(BOTH FROM VALUE::text)) > 0));

Notice that ::text after BOTH FROM VALUE, then pg_restore can pass the sql above, but it will still fail because this is not the only place to fix (there's another one wt_target_alias_xxx).

@yongzhang
Copy link
Contributor Author

ok, now this is the final solution:

ALTER DOMAIN public.wt_alias DROP CONSTRAINT wt_alias_no_suround_spaces;
ALTER DOMAIN public.wt_alias DROP CONSTRAINT wt_alias_too_short;
ALTER DOMAIN public.wt_alias ADD CONSTRAINT wt_alias_no_suround_spaces CHECK ((TRIM(BOTH FROM VALUE::text) = (VALUE)::text));
ALTER DOMAIN public.wt_alias ADD CONSTRAINT wt_alias_too_short CHECK (("length"(TRIM(BOTH FROM VALUE::text)) > 0));

ALTER DOMAIN public.wt_target_alias DROP CONSTRAINT wt_target_alias_too_long;
ALTER DOMAIN public.wt_target_alias ADD CONSTRAINT wt_target_alias_too_long CHECK ((length(TRIM(BOTH FROM VALUE::text)) < 254));

Upgrades successfully completed! Probably the boundary team can add a pg migration to fix this if it is the correct solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant