Bugs item #1825466, was opened at 2007-11-04 06:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1825466&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Firebird/Interbase
Group: SQLObject release (specify)
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Igor Aguiar (igor_aguiar)
Assigned to: Nobody/Anonymous (nobody)
Summary: Reserved words as table/column name in Firebird
Initial Comment:
Hi, first of all I would like to thank you guys for this amazing software.
I'm pretty new to Python and I was playing with SQLObject using the IDLE IDE, when I tried to run the following code:
#--- START OF CODE
from sqlobject import *
from sqlobject.inheritance import InheritableSQLObject
con = connectionForURI('firebird://SYSDBA:masterkey@localhost//var/lib/firebird2/data/sqlobj.fdb')
sqlhub.processConnection = con
class Person(InheritableSQLObject):
firstName = StringCol(length=100, notNone=True)
middleInitial = StringCol(length = 1, default = None)
lastName = StringCol(length=100, notNone=True)
class User(Person):
login = StringCol(length=20, notNone=True, unique=True)
password = StringCol(length=20, notNone=True)
Person.createTable()
User.createTable()
#--- END OF CODE
But a error occurs when the "User.createTable()" is performed. Below is the error:
#--- START OF ERROR
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
User.createTable()
File "/usr/lib/python2.5/site-packages/SQLObject-0.9.2-py2.5.egg/sqlobject/main.py", line 1378, in createTable
constraints = conn.createTable(cls)
File "/usr/lib/python2.5/site-packages/SQLObject-0.9.2-py2.5.egg/sqlobject/firebird/firebirdconnection.py", line 128, in createTable
(soClass.sqlmeta.table, self.createColumns(soClass)))
File "/usr/lib/python2.5/site-packages/SQLObject-0.9.2-py2.5.egg/sqlobject/dbconnection.py", line 342, in query
return self._runWithConnection(self._query, s)
File "/usr/lib/python2.5/site-packages/SQLObject-0.9.2-py2.5.egg/sqlobject/firebird/firebirdconnection.py", line 59, in _runWithConnection
val = meth(conn, *args)
File "/usr/lib/python2.5/site-packages/SQLObject-0.9.2-py2.5.egg/sqlobject/dbconnection.py", line 339, in _query
self._executeRetry(conn, conn.cursor(), s)
File "/usr/lib/python2.5/site-packages/SQLObject-0.9.2-py2.5.egg/sqlobject/dbconnection.py", line 334, in _executeRetry
return cursor.execute(query)
File "/var/lib/python-support/python2.5/kinterbasdb/__init__.py", line 1594, in execute
self.description = _k.execute(self._C_cursor, sql, params)
ProgrammingError: (-104, 'isc_dsql_prepare: Dynamic SQL Error. SQL error code = -104. Token unknown - line 1, char 14. user. ')
#--- END OF ERROR
Looking at the IDLE's Stack Viewer, I noticed that the SQL command generated to create the User table was something like this:
'CREATE TABLE user (\n id INT NOT NULL PRIMAR...AR(20) NOT NULL,\n child_name VARCHAR(255)\n)'
The problem, as you probably already noticed, is that USER is a reserved word, and Firebird won't let a table with this name be created.
Maybe surrounding the table's name with quotes would be a solution.
This is my configuration: Ubuntu 7.04, python 2.5, SQLObject 0.9.2 and FirebirdSQL 1.5.3.4870 super server.
Best regards,
Igor
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1825466&group_id=74338
|