Mkay, I dropped the table and deleted the ".table" file for it and all is well. I should have looked the at the table structure before that, silly me. I suspect that the column was already added before, but web2py did not register the fact and was trying to add a new one with the same name.
On Jan 20, 3:03 pm, Ivan P <ivanv...@gmail.com> wrote: > I am encountering a strange error, and was wondering if anybody else > has seen something like it. > The code: > auth.settings.table_user = db.define_table( > auth.settings.table_user_name, > Field('username', length=32, notnull=True, unique=True, > requires = [IS_LENGTH(minsize=3), IS_NOT_IN_DB > (db,auth.settings.table_user_name+'.username')]), > Field('first_name', length=128,default=''), > Field('last_name', length=128,default=''), > Field('email', length=128,default='', > requires = [IS_EMAIL()]), > Field('firm_name', length=128), > Field('address', length=256), > Field('firm_type', length=128), > Field('contact_name', length=128), > Field('phone', length=32), > Field('discount', 'double', default=0, requires=[IS_FLOAT_IN_RANGE > (0,1)]), > Field('password', 'password', readable=False, > label='Password', requires=CRYPT()), > Field('registration_key', length=128, > writable=False, readable=False,default='')) > > The traceback: > Traceback (most recent call last): > File "/home/anyapan/work/web2py/gluon/restricted.py", line 173, in > restricted > exec ccode in environment > File "/home/anyapan/work/web2py/applications/cparts/models/db.py", > line 49, in <module> > writable=False, readable=False,default='')) > File "/home/anyapan/work/web2py/gluon/sql.py", line 1252, in > define_table > t._create(migrate=migrate, fake_migrate=fake_migrate) > File "/home/anyapan/work/web2py/gluon/sql.py", line 1709, in _create > fake_migrate=fake_migrate) > File "/home/anyapan/work/web2py/gluon/sql.py", line 1763, in > _migrate > self._db._execute(sub_query) > File "/home/anyapan/work/web2py/gluon/sql.py", line 890, in <lambda> > self._execute = lambda *a, **b: self._cursor.execute(*a, **b) > OperationalError: duplicate column name: phone > > When I remove the "Field('phone'..." entry everything works fine. As > you see there is no other column with that name. > Thanks!
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.