Skip to content

CONCEPT Cited by 1 source

MySQL case-insensitive identifiers

MySQL table and column names are case-insensitive. Postgres identifiers are case-sensitive when quoted in double quotes, and folded to lowercase when unquoted. A Postgres schema that uses distinct identifiers differing only in case — e.g. "Customer" and "customer" — cannot be ported one-to-one into MySQL.

Postgres table and column names are case sensitive if in double quotes. MySQL table and column names, on the other hand, aren't case sensitive. So when doing a migration, make sure to keep this in mind.

sources/2026-04-21-planetscale-migrating-from-postgres-to-mysql

The rules

Postgres

  • Unquoted: identifiers fold to lowercase. SELECT FROM Customer = SELECT FROM customer.
  • Double-quoted: exact-case match required. "Customer" and "customer" are different tables.

MySQL

  • Column names: case-insensitive always.
  • Table names: case-sensitivity depends on the operating system and the lower_case_table_names system variable. On Linux default (0), table names are case-sensitive; on macOS/Windows default (1 or 2), they are case-insensitive or case-preserved. The safe assumption for cross-platform / cross-engine migration is treat identifiers as case-insensitive.

The same PlanetScale post calls out a dialect asymmetry at the expression layer:

MySQL allows for IF and IFNULL statements for evaluating conditions, while Postgres doesn't.

Postgres uses CASE WHEN and COALESCE. Any MySQL → Postgres migration has to rewrite IF() and IFNULL() calls; the reverse direction is a win because MySQL accepts both IF()/IFNULL() and SQL-standard CASE / COALESCE.

Migration implication

Postgres → MySQL:

  • Audit quoted identifiers. Every "Foo" identifier in DDL or queries must be checked against any case-variant siblings. If "Customer" and "customer" both exist, the MySQL migration has to rename one.
  • Normalise the schema to a single case convention before the migration — typically snake_case lowercase. This removes the Postgres-specific hazard and makes the MySQL side unambiguous.

MySQL → Postgres:

  • Lowercase all identifiers or quote consistently in all generated SQL; otherwise Postgres's folding rule will surprise the application at query time.
Last updated · 378 distilled / 1,213 read