コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
110 ビュー

Hello,

as  postgres user I have executed to following commands to import the cloud database dump to migrate the Odoo installation to one of our servers:

dropdb odoo

createdb -O odoo odoo

psql odoo < /dump_lang.sql


But the import crashes with a number of errors:

....

ERROR:  null value in column "short_time_format" of relation "res_lang" violates not-null constraint

DETAIL:  Failing row contains (1, English (US), en_US, en, en, t, ltr, %m/%d/%Y, %H:%M:%S, null, 7, [3,0], ., ,, 1, 2022-06-29 17:39:34.171452, 1, 2023-03-24 00:13:17.176204).

CONTEXT:  COPY res_lang, line 1: "1 English (US) en_US en en t ltr %m/%d/%Y %H:%M:%S 7 [3,0] . , 1 2022-06-29 17:39:34.171452 1 2023-0..."

......

ERROR:  relation "public.base_registry_signaling" does not exist

LINE 1: SELECT pg_catalog.setval('public.base_registry_signaling', 6...

......

ERROR:  insert or update on table "website" violates foreign key constraint "website_default_lang_id_fkey"

DETAIL:  Key (default_lang_id)=(1) is not present in table "res_lang".

ERROR:  insert or update on table "website_lang_rel" violates foreign key constraint "website_lang_rel_lang_id_fkey"

DETAIL:  Key (lang_id)=(1) is not present in table "res_lang".

...

ERROR:  insert or update on table "website_visitor" violates foreign key constraint "website_visitor_lang_id_fkey"

DETAIL:  Key (lang_id)=(1) is not present in table "res_lang".

.....


My expectation was, that the dump contains all required information to migrate the installation. Obviously that is not the case.

Does anyone have an idea how to solve errors mentioned above?


Thanks for any help or suggestions,

Stefan



アバター
破棄

Does "cloud database dump" mean Odoo Online or odoo.sh? In any case, can't you download a full backup from https://yourdomain.com/web/databse/manager and upload at the new server the same way?

著作者

"Cloud database dump" means, that I can only download the database from the web interface on odoo.com. There is no access to the database manager web interface like on a on-prem installation. And there is no way to set any option prior to the download.

最善の回答

Hi,


Since you’re working with Odoo 18, the problem comes from trying to restore an SQL dump that doesn’t fully match the Odoo 18 schema.


* Columns like short_time_format or tables like base_registry_signaling only exist in Odoo 18 (they were added/changed compared to older versions).

* If your dump was taken in plain SQL (pg_dump … > dump.sql), it might not include all schema details in the right order. That causes missing foreign keys and constraint violations during import.


Fix:-

1- Both source and target must be Odoo 18 (same edition: Community or Enterprise, same patch).


2- Use custom-format dump (not plain SQL):


On source server:


pg_dump -U odoo -h source_host -Fc source_db > full_dump.dump


This includes schema + data in the correct order.



3-Prepare empty database on target


    Start your new Odoo 18 instance once so it creates its base schema.


    Drop and recreate the DB:


    dropdb -U odoo odoo

    createdb -U odoo -O odoo odoo


4- Restore with pg_restore


pg_restore -U odoo -d odoo full_dump.dump


5- Update Odoo modules after restore


Run:


odoo -u all -d odoo


This makes sure any missing fields, constraints, or new schema changes are applied.




Hope it helps

アバター
破棄
関連投稿 返信 ビュー 活動
1
3月 23
2535
1
1月 20
6496
2
8月 18
10558
1
4月 17
3794
1
1月 25
6295