Skip to content

fix: skip MySQL expression indexes with null COLUMN_NAME during introspection#5576

Open
jaydeep-pipaliya wants to merge 1 commit intodrizzle-team:mainfrom
jaydeep-pipaliya:fix/mysql-expression-index-crash
Open

fix: skip MySQL expression indexes with null COLUMN_NAME during introspection#5576
jaydeep-pipaliya wants to merge 1 commit intodrizzle-team:mainfrom
jaydeep-pipaliya:fix/mysql-expression-index-crash

Conversation

@jaydeep-pipaliya
Copy link
Copy Markdown

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

…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
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.

[BUG]: MySQL introspection crashes on functional/expression indexes (COLUMN_NAME is null)

1 participant