Lift table_name character limit for async FK validations

What does this MR do and why?

This MR increases the character limit on the table_name field for the postgres_async_foreign_key_validations table from 63 to 127 characters.

When using prepare_async_foreign_key_validation for partitioned tables, the table name includes the schema prefix (e.g., gitlab_partitions_dynamic.merge_request_diff_files_99208b8fac), which exceeds the current 63 character limit.

The new validation rule allows: schema_name(63) + .(1) + table_name(63) = 127

This follows the same pattern as !121513 (merged) which made the same change for postgres_async_indexes.

Database

The new validation works with all existing records. The constraint change is:

  • Old: check_cd435d6301 CHECK ((char_length(table_name) <= 63))
  • New: check_async_fk_validation_table_name_length CHECK ((char_length(table_name) <= 127))

Migration output

Up:

main: == 20260408183510 AddNewAsyncFkValidationTableNameLengthConstraint: migrating =
main: -- execute("ALTER TABLE postgres_async_foreign_key_validations ADD CONSTRAINT check_async_fk_validation_table_name_length CHECK ( char_length(table_name) <= 127 ) NOT VALID;")
main: == 20260408183510 AddNewAsyncFkValidationTableNameLengthConstraint: migrated

main: == 20260408183511 ValidateAsyncFkValidationTableNameLengthConstraint: migrating
main: -- execute("ALTER TABLE postgres_async_foreign_key_validations VALIDATE CONSTRAINT check_async_fk_validation_table_name_length;")
main: == 20260408183511 ValidateAsyncFkValidationTableNameLengthConstraint: migrated

main: == 20260408183512 RemoveOldAsyncFkValidationTableNameLengthConstraint: migrating
main: -- execute("ALTER TABLE postgres_async_foreign_key_validations DROP CONSTRAINT IF EXISTS check_cd435d6301")
main: == 20260408183512 RemoveOldAsyncFkValidationTableNameLengthConstraint: migrated

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #422769

Merge request reports

Loading