Skip to content

Commit ea68d56

Browse files
bpamiriclaude
andcommitted
Fix case sensitivity for PostgreSQL and Oracle identifier quoting
PostgreSQL folds unquoted identifiers to lowercase, so double-quoted identifiers must also be lowercase to match. Oracle folds unquoted identifiers to uppercase, so double-quoted identifiers must be uppercase. Without this fix, quoting mixed-case table/column names causes "relation not found" errors because the quoted name doesn't match the case stored in the database. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent b37cb4c commit ea68d56

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/src/wheels/databaseAdapters/Oracle/OracleModel.cfc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ component extends="wheels.databaseAdapters.Base" output=false {
148148
* Oracle uses double-quotes to quote identifiers.
149149
*/
150150
public string function $quoteIdentifier(required string name) {
151-
return """#arguments.name#""";
151+
// Oracle folds unquoted identifiers to uppercase, so we must uppercase
152+
// before quoting to match the actual stored name
153+
return """#UCase(arguments.name)#""";
152154
}
153155

154156
}

core/src/wheels/databaseAdapters/PostgreSQL/PostgreSQLModel.cfc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ component extends="wheels.databaseAdapters.Base" output=false {
182182
* PostgreSQL uses double-quotes to quote identifiers (ANSI SQL standard).
183183
*/
184184
public string function $quoteIdentifier(required string name) {
185-
return """#arguments.name#""";
185+
// PostgreSQL folds unquoted identifiers to lowercase, so we must lowercase
186+
// before quoting to match the actual stored name
187+
return """#LCase(arguments.name)#""";
186188
}
187189

188190
}

0 commit comments

Comments
 (0)