← Back to team overview

openerp-india team mailing list archive

[Bug 897098] Re: problem after restore: there is no primary key for referenced table "res_users"

 

Kelbethor, 
till now I do a reindex of tables that loose key attribute, so when I see this error, for ex. when I update module, doing some operation etc. I run via psql this query (here a list of broken tables finded in my DB, for now...), HTH:

sudo su - postgres
psql broken_db

alter table res_users add primary key (id);
alter table res_partner add primary key (id);
alter table res_groups add primary key (id);
alter table ir_act_window add primary key (id);
alter table ir_model_fields add primary key (id);
alter table ir_model add primary key (id);
alter table ir_act_report_xml add primary key (id);
alter table ir_values add primary key (id);
alter table wkf add primary key (id);
alter table wkf_activity add primary key (id);
alter table ir_act_server add primary key (id);
alter table ir_attachment add primary key (id);
alter table product_product add primary key (id);

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/897098

Title:
  problem after restore: there is no primary key for referenced table
  "res_users"

Status in OpenERP Server:
  Incomplete

Bug description:
  Hi, my installation: Ubu 10.4, pg 8.4 openerp 6.0.3 updated from launchpad.
  I usually use auto_backup but I try also with save DB in GTK menu (for daily backup).
  I try a restore (with u all after restore) on other server (ubu 10.4, pg 8.4, openerp 6.0.3 updated with same module in addons folder) I'm able to log in and use it but if I try all new module installation this is my error:

  ProgrammingError: there is no primary key for referenced table
  "res_users"

  I try also reindex from psql original DB, "backup-restore-updateall" but the same result, fortunally original DB works fine, so I can install new module back up and restore. 
  This problem occurs 4 times for me, till now I correct restoring an old DB or delete if is a testing db, but I open this bug because I wont' figure if I can restore DB in production environment... 
  Thanks, if other information are request, please ask, I do much test operations :)

  all server log:
  Environment Information : 
  System : Linux-2.6.38-12-generic-x86_64-with-Ubuntu-11.04-natty
  OS Name : posix
  Distributor ID:	Ubuntu
  Description:	Ubuntu 11.04
  Release:	11.04
  Codename:	natty
  Operating System Release : 2.6.38-12-generic
  Operating System Version : #51-Ubuntu SMP Wed Sep 28 14:27:32 UTC 2011
  Operating System Architecture : 64bit
  Operating System Locale : it_IT.UTF8
  Python Version : 2.7.1+
  OpenERP-Client Version : 6.0.3
  Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
    File "/home/administrator/Launchpad/openerp/server/bin/netsvc.py", line 489, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/home/administrator/Launchpad/openerp/server/bin/service/web_services.py", line 599, in dispatch
      res = fn(db, uid, *params)
    File "/home/administrator/Launchpad/openerp/server/bin/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/administrator/Launchpad/openerp/server/bin/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/administrator/Launchpad/openerp/server/bin/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/administrator/Launchpad/openerp/server/bin/addons/base/module/wizard/base_module_upgrade.py", line 98, in upgrade_module
      _db, pool = pooler.restart_pool(cr.dbname, update_module=True)
    File "/home/administrator/Launchpad/openerp/server/bin/pooler.py", line 60, in restart_pool
      return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
    File "/home/administrator/Launchpad/openerp/server/bin/pooler.py", line 39, in get_db_and_pool
      addons.load_modules(db, force_demo, status, update_module)
    File "/home/administrator/Launchpad/openerp/server/bin/addons/__init__.py", line 883, in load_modules
      processed_modules.extend(load_module_graph(cr, graph, status, report=report, skip_modules=processed_modules))
    File "/home/administrator/Launchpad/openerp/server/bin/addons/__init__.py", line 719, in load_module_graph
      init_module_objects(cr, package.name, modules)
    File "/home/administrator/Launchpad/openerp/server/bin/addons/__init__.py", line 414, in init_module_objects
      result = obj._auto_init(cr, {'module': module_name})
    File "/home/administrator/Launchpad/openerp/server/bin/osv/orm.py", line 2430, in _auto_init
      cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, logs[k]))
    File "/home/administrator/Launchpad/openerp/server/bin/sql_db.py", line 78, in wrapper
      return f(self, *args, **kwargs)
    File "/home/administrator/Launchpad/openerp/server/bin/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  ProgrammingError: there is no primary key for referenced table "res_users"

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/897098/+subscriptions


References