Download & Extend

Reserved SQL keywords being used

Project:Table Wizard
Version:6.x-1.3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

I was getting errors when analyzing tables like this:

# User warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'maxvalue) VALUES (33, 'tid', 0, 1, 1, 0, 0, 0, 'serial', 4, 142)' at line 1 query: INSERT INTO tw_columns (twtid, colname, weight, primarykey, availablefk, secure, ignorecol, isempty, coltype, minvalue, maxvalue) VALUES (33, 'tid', 0, 1, 1, 0, 0, 0, 'serial', 4, 142) in _db_query() (line 148 of /Users/steverude/Documents/workspace/guitarworld.com/httpdocs/includes/database.mysqli.inc).
# User warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'maxvalue) VALUES (33, 'vid', 1, 0, 0, 0, 0, 0, 'int', 2, 7)' at line 1 query: INSERT INTO tw_columns (twtid, colname, weight, primarykey, availablefk, secure, ignorecol, isempty, coltype, minvalue, maxvalue) VALUES (33, 'vid', 1, 0, 0, 0, 0, 0, 'int', 2, 7) in _db_query() (line 148 of /Users/steverude/Documents/workspace/guitarworld.com/httpdocs/includes/database.mysqli.inc).
# User warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'maxvalue) VALUES (33, 'weight', 4, 0, 0, 0, 0, 0, 'int', -10, 9)' at line 1 query: INSERT INTO tw_columns (twtid, colname, weight, primarykey, availablefk, secure, ignorecol, isempty, coltype, minvalue, maxvalue) VALUES (33, 'weight', 4, 0, 0, 0, 0, 0, 'int', -10, 9) in _db_query() (line 148 of /Users/steverude/Documents/workspace/guitarworld.com/httpdocs/includes/database.mysqli.inc).

You are using minvalue and maxvalue as column names in tw_column. Per [#141051] these are SQL reserved keywords. Need to change these to something else. I am changing these to minnumvalue and maxnumvalue in order to avoid the problem with name clashes with the SQL reserved keywords.

Please see attached patch.

Comments

#1

Patch attached this time.

AttachmentSize
tw_1100896_1.patch 6.11 KB

#2

Ignore the last patch, needed to add update hook for changing existing tables.

AttachmentSize
tw_1100896_2.patch 6.84 KB

#3

Status:active» needs review

#4

Bump. I know you don't want to work on this any more in favor of data module, but if you need someone to make the commits just give me git access and I'll update the module for you.

#5

I am seeing this issue as well. Can we get this patch added? Thanks

#6

Status:needs review» reviewed & tested by the community

I am seeing this too and can confirm the changes in this patch resolve the issue.

nobody click here