Skip to content

Bug: parseEnumType returns escaped backslashes in enum names instead of unescaping them #663

@claude

Description

@claude

Bug Description

When parsing Enum types with escaped single quotes in their names (e.g. Enum8('f\'' = 1)), the parseEnumType function returns the raw escaped form of the name (f\') instead of the unescaped form (f').

Root Cause

In packages/client-common/src/parse/column_types.ts, the parseEnumType function correctly identifies escape sequences to find the closing quote, but does not unescape the extracted name:

// ~line 330
const name = columnType.slice(startIndex, i)
// name is 'f\'' (with backslash) instead of 'f'' (without)

Example

parseEnumType({ columnType: "Enum8('f\\'' = 1)", sourceType: "Enum8('f\\'' = 1)" })
// returns: { values: { 1: "f\\'" } }   <- includes backslash (wrong)
// expected: { values: { 1: "f'" } }    <- unescaped (correct)

Related

Reported via cross-repo analysis from ClickHouse/integrations-ai-playground#17.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions