#1427 ✓resolved
ahto

Quoting of name on mysql

Reported by ahto | October 4th, 2010 @ 09:05 AM | in 1.1

I'm currently running MySQL 5.1.41 and datamapper gems (versions 1.0.2) and I'm having problems using constraints.

I'm no expert but I'm guessing it has to do with the way names are quoted.
For example here is a debug output of the first query that fails with mysql complaining about the syntax.

SELECT COUNT(*) FROM "information_schema"."table_constraints" WHERE "constraint_type" = 'FOREIGN KEY' AND "table_schema" = 'ultra_dev' AND "table_name" = 'subscriptions' AND "constraint_name" = 'subscriptions_account_fk'

As you can see the names are quoted using normal double quotes and when they are replaced by ` the query runs ok.

Example that works

SELECT COUNT(*) FROM `information_schema`.`table_constraints` WHERE `constraint_type` = 'FOREIGN KEY' AND `table_schema` = 'ultra_dev' AND `table_name` = 'subscriptions' AND `constraint_name` = 'subscriptions_account_fk'

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by

Pages