PostgreSQL – How to Use pgloader to Transfer SQLite to Postgres with Uppercase Table Names

migrationpostgresqlsqlite

I can use pgloader to transfer my sqlite database to postgres as described in this quickstart page.

But the result is all my tables' names are lowercases. e.g. TestName -> testname

Is there any way I can preserve the uppercase in my table names?

Best Answer

In SQLite, table names always are case-insensitive (even when quoted).

In PostgreSQL, unquoted identifiers are folded to lower case, but then the search for the table is done case-sensitively. So the only way to get the same behaviour as in SQLite queries is to use unquoted names, which implies that the actual names must be lower case. In other words: the table name must be testname in order for a query like SELECT * FROM TestName to work correctly.