Roundup Tracker - Issues

Issue 1397569

classification
MySQL 5.0 init fails because 'schema' is reserved word
Type: Severity: normal
Components: Installation Versions:
process
Status: closed fixed
:
: richard : a1s, richard
Priority: normal :

Created on 2006-01-05 08:39 by anonymous, last changed 2006-03-03 08:48 by richard.

Messages
msg2095 Author: [hidden] (anonymous) Date: 2006-01-05 08:39
I've just migrated from anydbm to MySQL 5.0.15 /
roundup-0.8.5. In the process, I had to solve a
problem, and I'm letting you guys know hoping that one
of you will incorporate the solution in future versions
of Roundup.

It seems that MySQL 5.0 now has the reserved word
'schema', which means the the init of a tracker fails
with an SQL parse error similar to this:

roundup.hyperdb.DatabaseError: (1064, "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 'from schema' at line 1")

Changing every SQL occurrence of 'schema' to 'dbschema'
in rdbms_common.py and back_mysql.py solved my problem.
Everything seems to work fine now. I guess you'd have
to do this for postgresql as well, to keep things
functional.

Searching the net, it seems that another solution would
be to use backticks in the sql:

From
http://article.gmane.org/gmane.comp.bug-tracking.roundup.user/6128:

   So change (around line 166) in rdbms_common.py
   self.cursor.execute('select schema from schema')
   self.cursor.execute('select `schema` from `schema`')


This may be more appealing considering there'd be no
migration issues.


Kind regards,
Tue Wennerberg
twen_noob_nerberg@premi_noob_tech.com (remove _noob_)
msg2096 Author: [hidden] (a1s) Date: 2006-01-05 08:55
Logged In: YES 
user_id=8719

backticks are non-standard as far as i know.  standard name
quoting is double quotes, but quoted names may be case
sensitive; i am not sure if "schema" will always find column
named "SCHEMA".
msg2097 Author: [hidden] (richard) Date: 2006-01-13 01:19
Logged In: YES 
user_id=6405

MySQL ... "standard" ... hahahahahahaha    
   
Have overridden the load_dbschema() for MySQL. Thanks for 
the investigation, Tue. 
msg2098 Author: [hidden] (anonymous) Date: 2006-01-13 07:15
Logged In: NO 

Richard,

If you used the backticks approach, I hope you've tested it,
because I didn't have much luck with that.

- Tue
msg2099 Author: [hidden] (a1s) Date: 2006-02-28 05:43
Logged In: YES 
user_id=8719

`schema` remains unescaped in line 169 of back_mysql.py:

 self.sql("CREATE TABLE schema (schema TEXT) TYPE=%s"%

see also
http://article.gmane.org/gmane.comp.bug-tracking.roundup.user/6483
msg2100 Author: [hidden] (richard) Date: 2006-03-03 08:48
Logged In: YES 
user_id=6405

Damn, I missed load_dbschema in rdbms_common
History
Date User Action Args
2006-01-05 08:39:53anonymouscreate