(PS I have tried auth.define_tables(migrate='False') and it doesn't help) On 4 February 2011 13:22, Tom Atkins <minkto...@gmail.com> wrote:
> I am getting the same error as reported by Carlos and cannot fix it. > > I have just set up a new server (Ubuntu 10.04 - postgres 8.4, Python 2.6.5) > and have web2py trunk up and running fine. I have an unmodified 'welcome' > app which runs perfectly with sqlite. > > I then delete all the files in databases, cache and sessions. Next I > create a postgresql database and grant permissions to the appropriate user. > I have double checked this and the user can create tables on the database. > > Next change the connection details in the welcome app db.py to: > > db = DAL('postgres://myuser:mypasswordlocalhost/mydb') > > Then visit the URL and I get the ticket below. > > Any help gratefully appreciated. (I had this running fine on a previous > server) > > ------------------------ > > Traceback (most recent call last): > File "/home/www-data/web2py/gluon/restricted.py", line 188, in restricted > exec ccode in environment > File "/home/www-data/web2py/applications/welcome/models/db.py", line 32, > in <module> > auth.define_tables() # creates all needed > tables > File "/home/www-data/web2py/gluon/tools.py", line 1177, in define_tables > format='%(first_name)s %(last_name)s (%(id)s)') > File "/home/www-data/web2py/gluon/dal.py", line 3489, in define_table > polymodel=polymodel) > File "/home/www-data/web2py/gluon/dal.py", line 531, in create_table > self.create_sequence_and_triggers(query,table) > File "/home/www-data/web2py/gluon/dal.py", line 1512, in > create_sequence_and_triggers > self.execute('CREATE SEQUENCE %s;' % sequence_name) > File "/home/www-data/web2py/gluon/dal.py", line 1078, in execute > return self.log_execute(*a, **b) > File "/home/www-data/web2py/gluon/dal.py", line 1075, in log_execute > return self.cursor.execute(*a,**b) > ProgrammingError: relation "auth_user_id_seq" already exists > > ERROR SNAPSHOT > <class 'psycopg2.ProgrammingError'>(relation "auth_user_id_seq" already > exists > > > Frames > > File /home/www-data/web2py/gluon/restricted.py in restricted at line > 188 code arguments variables > > File /home/www-data/web2py/applications/welcome/models/db.py in <module> at > line 32 code arguments variables > > File /home/www-data/web2py/gluon/tools.py in define_tables at line > 1177 code arguments variables > > File /home/www-data/web2py/gluon/dal.py in define_table at line > 3489 code arguments variables > > File /home/www-data/web2py/gluon/dal.py in create_table at line > 531 code arguments variables > > File /home/www-data/web2py/gluon/dal.py in create_sequence_and_triggers at > line 1512 code arguments variables > > File /home/www-data/web2py/gluon/dal.py in execute at line > 1078 code arguments variables > > File /home/www-data/web2py/gluon/dal.py in log_execute at line > 1075 code arguments variables > > Function argument list > > (self=<gluon.dal.PostgreSQLAdapter object>, *a=('CREATE SEQUENCE > auth_user_id_Seq;',), **b={}) > > Code listing > > 1070. > 1071. > 1072. > 1073. > 1074. > 1075. > 1076. > 1077. > 1078. > 1079. > > def create_sequence_and_triggers(self, query, table, **args): > self.execute(query) > > def log_execute(self,*a,**b): > self.db._lastsql = a[0] > return self.cursor.execute(*a,**b) > > def execute(self,*a,**b): > return self.log_execute(*a, **b) > > Variables > > a('CREATE SEQUENCE auth_user_id_Seq;',) > self.cursor<cursor object at 0xba1152cc; closed: 0> > self<gluon.dal.PostgreSQLAdapter object> > b{} > self.cursor.execute<built-in method execute of psycopg2._psycopg.cursor > object>