emma cannot insert records into tables containing a field that is a keyword

Bug #676775 reported by Rocko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
emma (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: emma

To reproduce this, create a table with a field that is a keyword, eg `key`. For example:

CREATE TABLE `settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `key` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='utf8_unicode_ci'

Then attempt to insert a record into the table using emma.

When you press the green tick to execute the insert, Emma reports an SQL error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server for the right syntax to use near 'key='test''.

ie Emma isn't wrapping the fieldnames in ``, so it is issuing:

INSERT INTO `settings` (key) VALUES ('test')

instead of the SQL:

INSERT INTO `settings` (`key`) VALUES ('test')

Updating existing records works just fine.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: emma 0.6-4
Uname: Linux 2.6.37-rc2-dtresp x86_64
NonfreeKernelModules: nvidia
Architecture: amd64
CheckboxSubmission: 1bd8e90541d49b96c13cbfcc9baf103b
CheckboxSystem: d00f84de8a555815fa1c4660280da308
Date: Thu Nov 18 09:08:02 2010
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Alpha amd64 (20100224.1)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_AU.utf8
 SHELL=/bin/bash
SourcePackage: emma

Revision history for this message
Rocko (rockorequin) wrote :
Revision history for this message
Rocko (rockorequin) wrote :

The insert statement is constructed in __init__.py. This patch fixes the problem for me.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.