Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column case is ignored #649

Closed
chrisspen opened this issue Oct 19, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@chrisspen
Copy link

commented Oct 19, 2017

I converted a mysql database to postgres by running:

pgloader mysql://olduser:oldpass@oldhost/olddb postgresql://newuser:newpass@newhost/newdb

and the new postgres database is unusable by my application because the case is broken in any column name that used mixed or camel case. e.g. A column called someColumn gets turned into somecolumn, which in postgres are not the same. It appears all columns were converted to lower-case.

The help docs don't mention any option to change this. Is there any way to stop this from happening or is this a limitation of the tool?

@dimitri

This comment has been minimized.

Copy link
Owner

commented Oct 19, 2017

The default is to follow PosgreSQL defaults and down case every identifier. Use --with "quote identifiers" at the command line to get the behaviour you're asking for, keeping the exact case of your fields. Note that every use of those column names will have to be double-quoted when using PostgreSQL.

And yes it is documented at https://github.com/dimitri/pgloader/blob/master/pgloader.1.md#load-mysql-database

  - *downcase identifiers*

    When this option is listed, pgloader converts all MySQL identifiers
    (table names, index names, column names) to *downcase*, except for
    PostgreSQL *reserved* keywords.

	The PostgreSQL *reserved* keywords are determined dynamically by
	using the system function `pg_get_keywords()`.

  - *quote identifiers*

	When this option is listed, pgloader quotes all MySQL identifiers so
	that their case is respected. Note that you will then have to do the
	same thing in your application code queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.