fix: skip MySQL expression indexes with null COLUMN_NAME during introspection#5576
Open
jaydeep-pipaliya wants to merge 1 commit intodrizzle-team:mainfrom
Open
Conversation
…spection drizzle-kit pull crashes with TypeError: Cannot read properties of null (reading 'camelCase') when introspecting a MySQL 8+ database that contains functional/expression indexes. In MySQL 8+, expression indexes (e.g. CREATE UNIQUE INDEX idx ON t ((CASE WHEN col = 1 THEN 1 ELSE NULL END))) store NULL in the COLUMN_NAME field of INFORMATION_SCHEMA.STATISTICS. The serializer pushed this null value into the columns array, and later the casing function crashed trying to call .camelCase() on null. Skip index rows where COLUMN_NAME is null since Drizzle doesn't support expression indexes yet. This prevents the crash while allowing normal column-based indexes to be introspected correctly. Fixes drizzle-team#5546
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes drizzle-kit pull crash on MySQL 8+ databases with functional/expression indexes.
MySQL 8+ expression indexes return NULL for COLUMN_NAME in INFORMATION_SCHEMA.STATISTICS. The serializer pushed this null into the columns array, and later casing(null) crashed with TypeError.
Skip index rows where COLUMN_NAME is null since Drizzle doesn't support expression indexes yet.
Fixes #5546