#135 ProgrammingError in _queryInsertID

closed-invalid
nobody
Postgres (36)
5
2006-01-03
2005-12-06
Anonymous
No

Hi,

i'm using SQLObject packaged with TurboGears on an
existing PostgreSQL DB with the primary_key beeing a
string.

My model.py:
--------------------------
[...]
class Authreg(SQLObject):
class sqlmeta:
idType= StringType
idName = "username"

username = StringCol(alternateID = True)
[...]
--------------------------

Versions:

The latest SQLObject from repository ('cause of the
idType opportunity), python 2.4.2, PostgreSQL 7.4.9.

Accessing the existing entrys works fine, changing
those, too. Creating a new entry results in the
following traceback. It seems, that SQLObject tries to
receive a sequence from the DB although the primary_key
is a StringType.

Traceback:
--------------------------
Traceback (most recent call last):
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py",
line 271, in run
main()
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py",
line 502, in main
body = page_handler(*args, **cherrypy.request.paramMap)
File
"/usr/lib/python2.4/site-packages/TurboGears-0.8a4-py2.4.egg/turbogears/controllers.py",
line 121, in newfunc
output = func(self, *args, **kw)
File "/home/project/foo/bla/bla/controllers.py", line
86, in change
hash=new_hash)
File
"/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1346-py2.4.egg/sqlobject/main.py",
line 1248, in __init__
self._create(id, **kw)
File
"/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1346-py2.4.egg/sqlobject/main.py",
line 1277, in _create
self._SO_finishCreate(id)
File
"/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1346-py2.4.egg/sqlobject/main.py",
line 1301, in _SO_finishCreate
id, names, values)
File
"/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1346-py2.4.egg/sqlobject/dbconnection.py",
line 802, in queryInsertID
return self._dbConnection._queryInsertID(
File
"/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1346-py2.4.egg/sqlobject/postgres/pgconnection.py",
line 122, in _queryInsertID
c.execute("SELECT NEXTVAL('%s')" % sequenceName)
ProgrammingError: ERROR: relation
"authreg_username_seq" does not exist

SELECT NEXTVAL('authreg_username_seq')
--------------------------

Ruben Lang

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Hi,

    i think i know my fault. I'm using non-integer keys, and i'm
    not passing the id keyword to the constructor, instead i
    passed username (since this is my column used as key). Now i
    got to redesign a few things.

    Sorry for bothering you,

    Ruben Lang

     
  • Oleg Broytman

    Oleg Broytman - 2006-01-03
    • status: open --> closed-invalid
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks