Skip to content

getTable() fails with lowercase table names in Oracle 12c due to case sensitivity mismatch #12230

@AugustoPreis

Description

Issue description

getTable() does not return table metadata in Oracle 12c when the table name is provided in lowercase, even though the table was created without quoted identifiers and works correctly in standard SQL queries.

Expected Behavior

getTable('test1') should return the table metadata when the table exists in Oracle 12c and was created without quoted identifiers (e.g., CREATE TABLE TEST1).

Since Oracle automatically normalizes unquoted identifiers to uppercase, the method should either:

  • Handle case normalization internally for Oracle, or
  • Behave consistently with how Oracle resolves table names in SQL queries.

Actual Behavior

When calling:

await dataSource.driver.getTable('test1');

The method does not return the expected table metadata.

However, the following works:

await dataSource.driver.getTable('TEST1');

This inconsistency causes failures when using lowercase table names.

Steps to reproduce

  1. Use Oracle Database 12c.
  2. Create a table without quoted identifiers:
CREATE TABLE TEST1 (
  id NUMBER
);
  1. Connect to the database using TypeORM.
  2. Attempt to retrieve the table metadata using lowercase:
await dataSource.driver.getTable('test1');
  1. Observe that the table is not found.
  2. Repeat using uppercase:
await dataSource.driver.getTable('TEST1');
  1. Observe that it works correctly.

My Environment

  • TypeORM version: 0.3.20
  • Database: Oracle Database 12c
  • Node.js version: 22.17.1
  • Operating System: Ubuntu 24.04 (WSL)
  • Additional dependencies (if any): None

Additional Context

In Oracle 12c, unquoted identifiers are automatically stored in uppercase. While standard SQL queries are case-insensitive for such identifiers, the getTable() method appears to perform a case-sensitive lookup against database metadata.

This creates inconsistency between:

  • SQL execution behavior (SELECT * FROM test1)
  • Metadata retrieval behavior (getTable('test1'))

A possible improvement would be either:

  • Normalizing table names to uppercase internally for Oracle, or
  • Clearly documenting that Oracle requires uppercase table names when using getTable().

This would improve consistency and prevent confusion for users working with Oracle.

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions