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

fix: EXPOSED-695 DDL for unnamed check constraints fails when table has schema name #2368

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

bog-walk
Copy link
Member

Description

Summary of the change:
Check constraints created without user-specified names now use full table name with any dot-prefixed schema name replaced with underscores.

Detailed description:

  • Why:

A schema-prefixed table name currently uses the full name (with dot character) when generating a name for unnamed check constraints. This results in syntax exceptions or schema-not-found exceptions because something like this Table("my_schema.my_table") will name the constraint check_my_schema.my_table_index_1.

  • How:
    • Move common unquoting and . character replacement logic to private Table properties
    • Use above logic when generating constraint name instead of raw tableName
    • These constraints will be named like check_my_schema_my_table_index_1 to match pattern used when naming implicit column constraints.

Type of Change

Please mark the relevant options with an "X":

  • Bug fix

Affected databases:

  • All

Checklist

  • Unit tests are in place
  • The build is green (including the Detekt check)
  • All public methods affected by my PR has up to date API docs
  • Documentation for my change is up to date

Related Issues

EXPOSED-695

…as schema name

A schema-prefixed table name uses the full name (with dot character) when generating
a name for unnamed check constraints. This results in syntax exceptions or schema
not found exceptions.

Generated names of check constraints now sanitize the full table name to replace
dots with underscores.
@bog-walk bog-walk requested a review from obabichevjb January 22, 2025 18:09
@bog-walk bog-walk merged commit 20c0cde into main Jan 23, 2025
5 checks passed
@bog-walk bog-walk deleted the bog-walk/fix-check-constraint-with-schema branch January 23, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants