2

We have a pile of old databases in archives that have a column named RANGE in one of the tables. These database could have been created in MySQL 4.1 or 5.0. In MySQL 5.1+, RANGE is apparently a keyword for the query language. So now we have to change our schema for that table or we won't have any data at all. Just to be clear, its not that we have data with a value of "RANGE", but a column in a row is named "RANGE".

That's not a problem, but how do we support using the old database archives?

Some archives are the output of mysqldump or some equivalent so it looks like a MySQL flavor of SQL. Some archives are just copies of the database directory from the data directory of MySQL. We are only using the MyISAM engine because we don't need transaction support.

Can they be restored back no problem, or will we have to "convert" them to the new schema first to get MySQL 5.1 to use them?

Jay R.
  • 31,911
  • 17
  • 52
  • 61

1 Answers1

3

Can you not just use the ` character to surround any usage of the word range?

Artem Russakovskii
  • 21,516
  • 18
  • 92
  • 115
  • Does not work. Even if it did, wouldn't that be the same as renaming RANGE to 'RANGE', so I might as well name it something else entirely instead of quoting it. But, its still the same problem. – Jay R. Nov 04 '09 at 20:05
  • 1
    no, not ', `. the difference is the first is a single quote, and the second is a back-tick. – longneck Nov 04 '09 at 20:53
  • It certainly looks like Artem is right: http://stackoverflow.com/questions/261455/using-backticks-around-field-names – Bob Cross Nov 04 '09 at 20:59