3

Why is it that different platforms (linux vs windows) does not support the same naming conventions? I'm stunned by the fact that the documentation uses file names as an excuse for this.

Yes, windows is not case sensitive for file names but one would think the developers would accommodate for this. I (personal preference) despise the under_score_convention and prefer camelCaseConvention.

Is there a way to enable the camel case sensitivity when connecting to the database, or is this something that has to be done in the default configuration?

Are there alternatives to MySQL that support the camelCaseConvention as per default on all platforms?

Edit

Ok, I feel a bit stupid now, I updated to mysql 5.5 and the camel-case convention is now supported, by lowering the entire name. It does not however preserve the camel-case, which is part of what I'm looking for.

2
  • Why is it even a problem? You can still query using mixed-case, even if the DB doesn't care.
    – Philᵀᴹ
    Feb 5, 2013 at 0:16
  • It is quite a problem since many IDEs support data-source connections and provide code-completion for tables and columns. This function would only allow for pattern mixing. Even if the data-source does not care, it's a matter of readability and efficiency.
    – Daniel
    Feb 5, 2013 at 7:57

2 Answers 2

8

The SQL standard defines that identifiers are not case sensitive (unless double-quoted: "CamelCase"). Your desire for CamelCase (mixed-case) names conflicts with the standard and you'd better learn to live with it. Or you start double-quoting your identifiers and never forget to do so.

Most RDBMS actually implement standard(-like) behavior. Even MySQL tries, lately, but it's very hard to break with established syntax rules.

Resources

3
  • I guess I just have to learn to live with it. In the end it all comes down to personal preference. I guess I draw parallels between object design and schema design, which would be a nice thing - using the same naming conventions for tables as my java/php objects.
    – Daniel
    Feb 5, 2013 at 8:01
  • @Erwin, What do you mean by "unless quoted"?
    – Pacerier
    Apr 9, 2015 at 19:42
  • 1
    @Pacerier: Double-quoting preserves original case-sensitive spelling. I clarified a bit. Apr 9, 2015 at 21:28
2

MySQL case sensitivity can come back to bite you (I am talking alligator, pitbull, great white shark) if you ever move data with foreign key constraints.

I had a rather horrific experience helping a client move MySQL data from a Linux box to a Windows box. None of the foreign key constraints were working. It almost drove me to the point of insanity until I caught on. The case sensitivity of the referenced column and table names turned out to be the issue.

The solution was to do perform two mysqldumps and load them as follows:

  • mysqldump the data only into a text file for data
  • mysqldump the schema only into a text file for the schema
  • edit all the constraints in the schema file to be all lowercase
  • load the schema file into the target DB
  • load the data file into the target DB

Q.E.D.

I wrote about this before : Is it possible to use the same directory for 2 MySQL servers?

2
  • Yes, I can see the problem, that was why I wondered if the case sensitivity could be defined when connecting.
    – Daniel
    Feb 5, 2013 at 8:02
  • The lower case options for mysql are server-level start options only. They are not configurable for client connections AFAIK. Feb 5, 2013 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.