fix(oracle): preserve hash characters in SQL identifiers

This commit is contained in:
zipg authored and GitHub committed 2026-09-15 18:41:32 +08:00
1 parent df22dd49b9
commit cc573615cf
2 files changed
+20 -1

No files matched your search

@@ -1409,7 +1409,10 @@ function startsLineComment(sql: string, pos: number, databaseType?: DatabaseType
}
function startsHashLineComment(sql: string, pos: number, databaseType?: DatabaseType, parameterOptions?: SqlParameterOptions): boolean {
if (databaseType === "sqlserver" || sql[pos] !== "#") return false;
// `#` is a MySQL-family line-comment marker. Oracle-family engines also allow
// it in unquoted identifiers (for example `V$DATAFILE.FILE#`), so treating it
// as a comment there truncates otherwise valid statements.
if ((databaseType !== undefined && ORACLE_LIKE_PL_SQL_DATABASES.has(databaseType)) || databaseType === "sqlserver" || sql[pos] !== "#") return false;
return readSqlBracedParameterAt(sql, pos, parameterOptions)?.syntax !== "mybatis";
}