Hi Gents

I need some help fixing some issues with a postgresql database I use for openerp-server. I looked everywhere to find an answer but I couldn't get any reposes from OpenERP community. Hope some of you postgresql professionals could show me some indications on fixing my broken db.

Here are the errors I encountered starting openerp-server in debug mode:

postgres@nodesoft-dev:~$ cd /usr/lib/python2.5/site-packages/openerp-server
postgres@nodesoft-dev:/usr/lib/python2.5/site-packages/openerp-server$ /usr/bin/python2.5 ./openerp-server.py -dnodesoft --update=all --stop-after-init --log-level=debug --addons-path=/usr/lib/python2.5/site-packages/openerp-server/addons/
[2011-10-29 18:02:01,067] DEBUGsycopg2:installed. Logging using Python logging module
[2011-10-29 18:02:01,067] INFO:server:version - 5.0.6
[2011-10-29 18:02:01,067] INFO:server:addons_path - /usr/lib/python2.5/site-packages/openerp-server/addons
[2011-10-29 18:02:01,067] INFO:server:database hostname - localhost
[2011-10-29 18:02:01,067] INFO:server:database port - 5432
[2011-10-29 18:02:01,071] INFO:server:database user - postgres
[2011-10-29 18:02:01,071] INFObjects:initialising distributed objects services
[2011-10-29 18:02:01,239] INFO:dbpool:Connecting to nodesoft
[2011-10-29 18:02:01,379] INFO:init:module base: loading objects
[2011-10-29 18:02:01,379] INFO:init:module base: registering objects
[2011-10-29 18:02:01,491] INFO:init:module base: creating or updating database tables
[2011-10-29 18:02:08,251] DEBUG:sql:bad query: alter table "ir_model_data" add constraint "ir_model_data_module_name_uniq" unique(name, module)
[2011-10-29 18:02:08,251] DEBUG:sql:[01]: could not create unique index "ir_model_data_module_name_uniq"
[2011-10-29 18:02:08,251] DEBUG:sql:[02]: DETAIL: Table contains duplicated values.
[2011-10-29 18:02:08,251] WARNINGrm:[01]: unable to add 'unique(name, module)' constraint on table ir_model_data !
[2011-10-29 18:02:08,251] WARNINGrm:[02]: If you want to have it, you should update the records and execute manually:
[2011-10-29 18:02:08,251] WARNINGrm:[03]: ALTER table ir_model_data ADD CONSTRAINT ir_model_data_module_name_uniq unique(name, module)
[2011-10-29 18:02:27,611] DEBUGrm:creating new column datas of table ir_attachment
[2011-10-29 18:03:06,524] INFO:init:module base: loading base_data.xml
[2011-10-29 18:03:07,488] INFO:init:module base: loading base_menu.xml
[2011-10-29 18:03:07,828] INFO:init:module base: loading security/base_security.xml
[2011-10-29 18:03:08,496] DEBUG:sql:bad query: update "res_users" set "menu_id"=1,"address_id"=1,"action_id"=1,"company_ id"=1,"signature"=E'Administrator',write_uid=1,wri te_date=now() where id in (1)
[2011-10-29 18:03:08,496] DEBUG:sql:[01]: insert or update on table "res_users" violates foreign key constraint "res_users_address_id_fkey"
[2011-10-29 18:03:08,496] DEBUG:sql:[02]: DETAIL: Key (address_id)=(1) is not present in table "res_partner_address".
sh: bzr: command not found
sh: lsb_release: command not found
[2011-10-29 18:03:08,620] ERROR:init:[01]:
[2011-10-29 18:03:08,620] ERROR:init:[02]: Environment Information :
[2011-10-29 18:03:08,620] ERROR:init:[03]: System : Linux-2.6.26-2-xen-amd64-x86_64-with-debian-5.0.4
[2011-10-29 18:03:08,620] ERROR:init:[04]: OS Name : posix
[2011-10-29 18:03:08,620] ERROR:init:[05]: Operating System Release : 2.6.26-2-xen-amd64
[2011-10-29 18:03:08,620] ERROR:init:[06]: Operating System Version : #1 SMP Wed Jan 13 00:12:41 UTC 2010
[2011-10-29 18:03:08,620] ERROR:init:[07]: Operating System Architecture : 64bit
[2011-10-29 18:03:08,620] ERROR:init:[08]: Operating System Locale : en_US.ISO8859-1
[2011-10-29 18:03:08,620] ERROR:init:[09]: Python Version : 2.5.2
[2011-10-29 18:03:08,624] ERROR:init:[10]: OpenERP-Server Version : 5.0.6
[2011-10-29 18:03:08,624] ERROR:init:[11]: Last revision No. & ID :
[2011-10-29 18:03:08,624] ERROR:init:[12]: <record id="base.user_root" model="res.users">
[2011-10-29 18:03:08,624] ERROR:init:[13]: <field name="signature">Administrator</field>
[2011-10-29 18:03:08,624] ERROR:init:[14]: <field name="address_id" ref="main_address"/>
[2011-10-29 18:03:08,624] ERROR:init:[15]: <field name="company_id" ref="main_company"/>
[2011-10-29 18:03:08,624] ERROR:init:[16]: <field name="action_id" ref="action_menu_admin"/>
[2011-10-29 18:03:08,624] ERROR:init:[17]: <field name="menu_id" ref="action_menu_admin"/>
[2011-10-29 18:03:08,624] ERROR:init:[18]: </record>
Traceback (most recent call last):
File "./openerp-server.py", line 111, in <module>
pooler.get_db_and_pool(db, update_module=tools.config['init'] or tools.config['update'])
File "/usr/lib/python2.5/site-packages/openerp-server/pooler.py", line 40, in get_db_and_pool
addons.load_modules(db, force_demo, status, update_module)
File "/usr/lib/python2.5/site-packages/openerp-server/addons/__init__.py", line 687, in load_modules
has_updates = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
File "/usr/lib/python2.5/site-packages/openerp-server/addons/__init__.py", line 618, in load_module_graph
tools.convert_xml_import(cr, m, fp, idref, mode=mode, **kwargs)
File "/usr/lib/python2.5/site-packages/openerp-server/tools/convert.py", line 885, in convert_xml_import
obj.parse(xmlstr)
File "/usr/lib/python2.5/site-packages/openerp-server/tools/convert.py", line 779, in parse
self._tags[rec.nodeName](self.cr, rec, n)
File "/usr/lib/python2.5/site-packages/openerp-server/tools/convert.py", line 747, in _tag_record
id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode )
File "/usr/lib/python2.5/site-packages/openerp-server/addons/base/ir/ir_model.py", line 474, in _update
model_obj.write(cr, uid, [res_id], values)
File "/usr/lib/python2.5/site-packages/openerp-server/addons/base/res/res_user.py", line 185, in write
res = super(users, self).write(cr, uid, ids, values, *args, **argv)
File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 2458, in write
'where id in ('+ids_str+')', upd1)
File "/usr/lib/python2.5/site-packages/openerp-server/sql_db.py", line 76, in wrapper
return f(self, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/openerp-server/sql_db.py", line 120, in execute
res = self._obj.execute(query, params)
psycopg2.IntegrityError: insert or update on table "res_users" violates foreign key constraint "res_users_address_id_fkey"
DETAIL: Key (address_id)=(1) is not present in table "res_partner_address"