Relation "table" does not exist

665 views
Skip to first unread message

Gael Princivalle

unread,
Sep 14, 2015, 6:56:54 AM9/14/15
to web2py-users
Hello.

I've already read about this message error anyway I don't reach to find the solution.

Here here my db string:
db = DAL('postgres://user:pass@localhost:5432/my_db', check_reserved=['all'], pool_size=1, entity_quoting=True, bigint_id=True, migrate=True)

In db.py I've add some tables with relations, and cancel these tables.

When I try to add again a table called "cavities" that is in reference in a table called "model_c" (same names as the first time I've add these tables), when I try to see the empty table in the administration database I've this error:
relation "cavities" does not exist
LINE 1: SELECT count(*) FROM "cavities" WHERE ("cavities"."id" > 0);

The table:
db.define_table('cavities',
                Field('name', type='string', requires=IS_NOT_EMPTY()),
                format='%(name)s')

I've tried to add migrate=True to the connection string, I've cancel manually all old tables in the db, I've add the app in a totally new web2py application, and cancel also all the database app folder.
Always the same error.

Someone can give me a help?

Thanks.







Ovidio Marinho

unread,
Sep 14, 2015, 8:04:01 AM9/14/15
to web...@googlegroups.com
Use migrate=False or not use migrate in string of connection.





                   http://itjp.net.br
                     http://itjp.net.br
          Ovidio Marinho Falcao Neto
                 ovid...@gmail.com

                            Brasil
            

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gael Princivalle

unread,
Sep 14, 2015, 8:06:52 AM9/14/15
to web2py-users
Thanks Ovidio but the error still here also with migrate=False.
ProgrammingError: relation "cavities" does not exist
LINE 1: SELECT count(*) FROM "cavities" WHERE ("cavities"."id" > 0);

Ovidio Marinho

unread,
Sep 14, 2015, 8:24:11 AM9/14/15
to web...@googlegroups.com
show full tickets error

Gael Princivalle

unread,
Sep 14, 2015, 8:35:40 AM9/14/15
to web2py-users
 Traceback (most recent call last):
  File "/home/tasko/webapps/w2p_2_12_3_prod/web2py/applications/my_app/controllers/appadmin.py", line 238, in select
    nrows = db(query).count()
  File "/home/tasko/webapps/w2p_2_12_3_prod/web2py/gluon/packages/dal/pydal/objects.py", line 1992, in count
    return db._adapter.count(self.query,distinct)
  File "/home/tasko/webapps/w2p_2_12_3_prod/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1311, in count
    self.execute(self._count(query, distinct))
  File "/home/tasko/webapps/w2p_2_12_3_prod/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 360, in execute
    return BaseAdapter.execute(self, *a, **b)
  File "/home/tasko/webapps/w2p_2_12_3_prod/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1378, in execute
    return self.log_execute(*a, **b)
  File "/home/tasko/webapps/w2p_2_12_3_prod/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1372, in log_execute
    ret = self.cursor.execute(command, *a[1:], **b)
ProgrammingError: relation "cavities" does not exist
LINE 1: SELECT count(*) FROM "cavities" WHERE ("cavities"."id" > 0);

Anthony

unread,
Sep 14, 2015, 9:11:05 AM9/14/15
to web2py-users
Using external tools, can you confirm whether the table in question actually does exist in the database?

Gael Princivalle

unread,
Sep 14, 2015, 9:19:07 AM9/14/15
to web2py-users
Using phpPgAdmin I can see that the table in question does not exist. I've delete it.

Ovidio Marinho

unread,
Sep 14, 2015, 9:38:10 AM9/14/15
to web...@googlegroups.com
delete all tables in web2py/applications/name_application/databases and recriate tables , look is import psycopg2 in db.py

ex.:

import psycopg2
 
 
db = DAL('postgres://instance_postgres:user@localhost:5432/db_name')





                   http://itjp.net.br
                     http://itjp.net.br
          Ovidio Marinho Falcao Neto
                 ovid...@gmail.com

                            Brasil
            

Anthony

unread,
Sep 14, 2015, 9:42:18 AM9/14/15
to web2py-users
What happens if you delete the relevant *.table files in the /databases folder and then turn on migrations? Does the table not get created for you?

Ovidio Marinho

unread,
Sep 14, 2015, 10:06:53 AM9/14/15
to web...@googlegroups.com
The DAL uses the sql dialect to communicate with the database from this folder . As yet there are no data you can delete these archive that will be generated again thus entering the application admin . In case there in question there is no data in the database then you can delete if you have data then make a copy of the donated a backup , do the necessary maintenance and return .





                   http://itjp.net.br
                     http://itjp.net.br
          Ovidio Marinho Falcao Neto
                 ovid...@gmail.com

                            Brasil
            

Reply all
Reply to author
Forward
0 new messages