Skip to content

[Preflight] Do not report custom enums as unsupported types#1005

Merged
kvch merged 1 commit into
mainfrom
fix-check-enum-types
Jul 16, 2026
Merged

[Preflight] Do not report custom enums as unsupported types#1005
kvch merged 1 commit into
mainfrom
fix-check-enum-types

Conversation

@kvch

@kvch kvch commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Previously, pgstream check flagged every user-defined enum column as an unsupported type, e.g.:

schema_type_compatibility: "table_name"."column_name"."type": enum type "enum_name" unknown type; Cast the column to a supported type or exclude the table from the migration.

This is a false positive. The check only recognizes types that pgx 's static type map knows by OID, and enum OIDs are database-specific, so enums never resolve. But the Postgres target replicates enum values as text (with the enum type itself replicated via CREATE TYPE), so they migrate fine.

SchemaTypeCompatibilityCheck now skips enum columns. This covers both scalar enums (typtype = 'e') and arrays of enums (typtype = 'b') whose element carries the enum kind.

Type of Change

Please select the relevant option(s):

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test coverage improvement
  • 🔨 Build/CI changes
  • 🧹 Code cleanup

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Code is well-commented
  • Documentation updated where necessary

@kvch
kvch force-pushed the fix-check-enum-types branch from 552ebd5 to d51fef6 Compare July 16, 2026 15:14
@kvch
kvch requested a review from tsg July 16, 2026 15:16
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgstream/pkg/stream/preflight 72.45% (+0.21%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgstream/pkg/stream/preflight/schema.go 92.80% (+0.18%) 125 (+3) 116 (+3) 9 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/xataio/pgstream/pkg/stream/preflight/schema_test.go

@kvch
kvch merged commit fab8d5e into main Jul 16, 2026
8 checks passed
@kvch
kvch deleted the fix-check-enum-types branch July 16, 2026 15:24
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