[GH-ISSUE #42] Does restore works? #33

Closed
opened 2026-02-26 21:34:06 +03:00 by kerem · 16 comments
Owner

Originally created by @Persil090 on GitHub (Sep 10, 2024).
Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/42

Hey....first of all I was happy to start using that tool, it is one of the user friendliest I could find but I have issues with restoring.

I am trying to localhost odoo v17 that works with postgresql database in a container (docker compose version). But before moving to production i was testing backup and restore with PG back Web. I can connect to database (took me time as I did not know that before connecting I needed to add PGBackWeb network to db container that stores Odoo data) do a backup, but when restoring database and even though tool says it was successfully restored nothing is actually restored so I lost all demo data which is what concerns me.

My process was...
1.) create odoo 17 that contains postgresql container as well
2.) i did some changes to Odoo and activate some apps (CRM, Website) so that application was ready to test
3.) Then i run backup with PG Back Web for database backup
4.) In parallel I did backup of Odoo Web volume with Duplicati (I backup named volume).
5) then to test Postgresql restoring i removed Odoo 17 and Postgresql containers (+ all associated named volumes)
6)After I created again Odoo 17 with Postgresql container (via docker compose) and when i restored Postresql (via PGBackWeb) and Odoo Web (via Duplicati) nothing was actually restored.

What could i be missing? What is actually restored with PG Back Web?

Originally created by @Persil090 on GitHub (Sep 10, 2024). Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/42 Hey....first of all I was happy to start using that tool, it is one of the user friendliest I could find but I have issues with restoring. I am trying to localhost odoo v17 that works with postgresql database in a container (docker compose version). But before moving to production i was testing backup and restore with PG back Web. I can connect to database (took me time as I did not know that before connecting I needed to add PGBackWeb network to db container that stores Odoo data) do a backup, but when restoring database and even though tool says it was successfully restored nothing is actually restored so I lost all demo data which is what concerns me. My process was... 1.) create odoo 17 that contains postgresql container as well 2.) i did some changes to Odoo and activate some apps (CRM, Website) so that application was ready to test 3.) Then i run backup with PG Back Web for database backup 4.) In parallel I did backup of Odoo Web volume with Duplicati (I backup named volume). 5) then to test Postgresql restoring i removed Odoo 17 and Postgresql containers (+ all associated named volumes) 6)After I created again Odoo 17 with Postgresql container (via docker compose) and when i restored Postresql (via PGBackWeb) and Odoo Web (via Duplicati) nothing was actually restored. What could i be missing? What is actually restored with PG Back Web?
kerem closed this issue 2026-02-26 21:34:06 +03:00
Author
Owner

@Persil090 commented on GitHub (Sep 12, 2024):

I got full of those errors when restoring:

2024-09-12 15:43:43.332 UTC [211] ERROR: relation "res_partner_bank_unique_number" already exists
2024-09-12 15:43:43.332 UTC [211] STATEMENT: ALTER TABLE ONLY public.res_partner_bank
ADD CONSTRAINT res_partner_bank_unique_number UNIQUE (sanitized_acc_number, partner_id);
2024-09-12 15:43:43.393 UTC [211] ERROR: multiple primary keys for table "res_partner_category" are not allowed
2024-09-12 15:43:43.393 UTC [211] STATEMENT: ALTER TABLE ONLY public.res_partner_category
ADD CONSTRAINT res_partner_category_pkey PRIMARY KEY (id);
2024-09-12 15:43:43.393 UTC [211] ERROR: multiple primary keys for table "res_partner_industry" are not allowed
...
024-09-12 15:43:54.451 UTC [211] ERROR: relation "act_window_view_unique_mode_per_action" already exists
2024-09-12 15:43:54.451 UTC [211] STATEMENT: CREATE UNIQUE INDEX act_window_view_unique_mode_per_action ON public.ir_act_window_view USING btree (act_window_id, view_mode);
2024-09-12 15:43:54.958 UTC [211] ERROR: relation "auth_totp_device_user_id_index_idx" already exists
....
2024-09-12 15:43:55.506 UTC [211] STATEMENT: CREATE INDEX base_partner_merge_automatic__res_partner_id_base_partner_m_idx ON public.base_partner_merge_automatic_wizard_res_partner_rel USING btree (res_partner_id, base_partner_merge_automatic_wizard_id);
2024-09-12 15:43:55.507 UTC [211] ERROR: column "guest_id" does not exist at character 100
.....
2024-09-12 15:47:08.103 UTC [61] LOG: checkpoint starting: time
2024-09-12 15:49:10.052 UTC [61] LOG: checkpoint complete: wrote 1004 buffers (6.1%); 0 WAL file(s) added, 0 removed, 1 recycled; write=110.860 s, sync=10.217 s, total=121.949 s; sync files=653, longest=0.342 s, average=0.016 s; distance=7616 kB, estimate=14758 kB

<!-- gh-comment-id:2346671345 --> @Persil090 commented on GitHub (Sep 12, 2024): I got full of those errors when restoring: 2024-09-12 15:43:43.332 UTC [211] ERROR: relation "res_partner_bank_unique_number" already exists 2024-09-12 15:43:43.332 UTC [211] STATEMENT: ALTER TABLE ONLY public.res_partner_bank ADD CONSTRAINT res_partner_bank_unique_number UNIQUE (sanitized_acc_number, partner_id); 2024-09-12 15:43:43.393 UTC [211] ERROR: multiple primary keys for table "res_partner_category" are not allowed 2024-09-12 15:43:43.393 UTC [211] STATEMENT: ALTER TABLE ONLY public.res_partner_category ADD CONSTRAINT res_partner_category_pkey PRIMARY KEY (id); 2024-09-12 15:43:43.393 UTC [211] ERROR: multiple primary keys for table "res_partner_industry" are not allowed ... 024-09-12 15:43:54.451 UTC [211] ERROR: relation "act_window_view_unique_mode_per_action" already exists 2024-09-12 15:43:54.451 UTC [211] STATEMENT: CREATE UNIQUE INDEX act_window_view_unique_mode_per_action ON public.ir_act_window_view USING btree (act_window_id, view_mode); 2024-09-12 15:43:54.958 UTC [211] ERROR: relation "auth_totp_device_user_id_index_idx" already exists .... 2024-09-12 15:43:55.506 UTC [211] STATEMENT: CREATE INDEX base_partner_merge_automatic__res_partner_id_base_partner_m_idx ON public.base_partner_merge_automatic_wizard_res_partner_rel USING btree (res_partner_id, base_partner_merge_automatic_wizard_id); 2024-09-12 15:43:55.507 UTC [211] ERROR: column "guest_id" does not exist at character 100 ..... 2024-09-12 15:47:08.103 UTC [61] LOG: checkpoint starting: time 2024-09-12 15:49:10.052 UTC [61] LOG: checkpoint complete: wrote 1004 buffers (6.1%); 0 WAL file(s) added, 0 removed, 1 recycled; write=110.860 s, sync=10.217 s, total=121.949 s; sync files=653, longest=0.342 s, average=0.016 s; distance=7616 kB, estimate=14758 kB
Author
Owner

@hdjsadgfwtg commented on GitHub (Sep 14, 2024):

I also encountered this issue: pg16. Clicking 'Restore' shows 'Restore successful,' but in fact, nothing happens

<!-- gh-comment-id:2351089461 --> @hdjsadgfwtg commented on GitHub (Sep 14, 2024): I also encountered this issue: pg16. Clicking 'Restore' shows 'Restore successful,' but in fact, nothing happens
Author
Owner

@hdjsadgfwtg commented on GitHub (Sep 14, 2024):

~ # psql -U xiuxian -d juanzeng -f /var/lib/postgresql/data/dump.sql
SET
SET
SET
SET
SET
set_config

(1 row)

SET
SET
SET
SET
SET
SET
psql:/var/lib/postgresql/data/dump.sql:33: ERROR: relation "juanzengbiao" already exists
ALTER TABLE
psql:/var/lib/postgresql/data/dump.sql:15715: ERROR: duplicate key value violates unique constraint "juanzengbiao_pkey"
DETAIL: Key ("兑换码")=(xxxxxxx) already exists.
CONTEXT: COPY juanzengbiao, line 1
psql:/var/lib/postgresql/data/dump.sql:15723: ERROR: multiple primary keys for table "juanzengbiao" are not allowed

<!-- gh-comment-id:2351095408 --> @hdjsadgfwtg commented on GitHub (Sep 14, 2024): ~ # psql -U xiuxian -d juanzeng -f /var/lib/postgresql/data/dump.sql SET SET SET SET SET set_config ------------ (1 row) SET SET SET SET SET SET psql:/var/lib/postgresql/data/dump.sql:33: ERROR: relation "juanzengbiao" already exists ALTER TABLE psql:/var/lib/postgresql/data/dump.sql:15715: ERROR: duplicate key value violates unique constraint "juanzengbiao_pkey" DETAIL: Key ("兑换码")=(xxxxxxx) already exists. CONTEXT: COPY juanzengbiao, line 1 psql:/var/lib/postgresql/data/dump.sql:15723: ERROR: multiple primary keys for table "juanzengbiao" are not allowed
Author
Owner

@eduardolat commented on GitHub (Sep 15, 2024):

Hi @2598142880 , @Persil090 .

From what I see you are trying to restore to an existing database.

To make this work you have these 2 options:

1. Restore to a clean database

2. Activate the --clean option in your backup

image
image

<!-- gh-comment-id:2351334332 --> @eduardolat commented on GitHub (Sep 15, 2024): Hi @2598142880 , @Persil090 . From what I see you are trying to restore to an existing database. To make this work you have these 2 options: ### 1. Restore to a clean database ### 2. Activate the --clean option in your backup ![image](https://github.com/user-attachments/assets/45b70e9d-e3da-4b31-93c8-c6017a960517) ![image](https://github.com/user-attachments/assets/0edd774c-a027-48bf-b15a-878eabdf60ae)
Author
Owner

@eduardolat commented on GitHub (Sep 15, 2024):

I also encountered this issue: pg16. Clicking 'Restore' shows 'Restore successful,' but in fact, nothing happens

This message indicates that the backup has been started in the background, however it does not reflect the result of the operation.

I will try to clarify this better in future updates.

<!-- gh-comment-id:2351335210 --> @eduardolat commented on GitHub (Sep 15, 2024): > I also encountered this issue: pg16. Clicking 'Restore' shows 'Restore successful,' but in fact, nothing happens This message indicates that the backup has been started in the background, however it does not reflect the result of the operation. I will try to clarify this better in future updates.
Author
Owner

@hdjsadgfwtg commented on GitHub (Sep 15, 2024):

--clean

Oh, thank you for your help. I hope this option can be enabled by default in the future, or at least provide a promp

<!-- gh-comment-id:2351344082 --> @hdjsadgfwtg commented on GitHub (Sep 15, 2024): > --clean Oh, thank you for your help. I hope this option can be enabled by default in the future, or at least provide a promp
Author
Owner

@eduardolat commented on GitHub (Sep 15, 2024):

Is dangerous to enable this by default, it's better to keep using the pg_dump's defaults. But, can you try if it works for you?

<!-- gh-comment-id:2351344484 --> @eduardolat commented on GitHub (Sep 15, 2024): Is dangerous to enable this by default, it's better to keep using the pg_dump's defaults. But, can you try if it works for you?
Author
Owner

@hdjsadgfwtg commented on GitHub (Sep 15, 2024):

Is dangerous to enable this by default, it's better to keep using the pg_dump's defaults. But, can you try if it works for you?默认启用此功能很危险,最好继续使用 pg_dump 的默认设置。但是,你能尝试一下它是否适合你吗?

After deleting all the tables in my database, I successfully restored it, but instead of using pgbackweb, I used psql -U [username] -d [database_name] -f /absolute/path/to/dump.sql

<!-- gh-comment-id:2351344860 --> @hdjsadgfwtg commented on GitHub (Sep 15, 2024): > Is dangerous to enable this by default, it's better to keep using the pg_dump's defaults. But, can you try if it works for you?默认启用此功能很危险,最好继续使用 pg_dump 的默认设置。但是,你能尝试一下它是否适合你吗? After deleting all the tables in my database, I successfully restored it, but instead of using pgbackweb, I used psql -U [username] -d [database_name] -f /absolute/path/to/dump.sql
Author
Owner

@hdjsadgfwtg commented on GitHub (Sep 15, 2024):

My requirement is to restore it to the state it was in at the time of the backup

<!-- gh-comment-id:2351345102 --> @hdjsadgfwtg commented on GitHub (Sep 15, 2024): My requirement is to restore it to the state it was in at the time of the backup
Author
Owner

@eduardolat commented on GitHub (Sep 15, 2024):

Yes, that's exactly how it works. According pg_dump's documentation:

It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers).

Regarding the backup restorations, they work exactly the same way you just restored your database, so you can do it in the web GUI with the same result

<!-- gh-comment-id:2351345566 --> @eduardolat commented on GitHub (Sep 15, 2024): Yes, that's exactly how it works. According pg_dump's documentation: It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers). Regarding the backup restorations, they work exactly the same way you just restored your database, so you can do it in the web GUI with the same result
Author
Owner

@hdjsadgfwtg commented on GitHub (Sep 15, 2024):

So enabling '--clean' will have the same effect, right?

<!-- gh-comment-id:2351346139 --> @hdjsadgfwtg commented on GitHub (Sep 15, 2024): So enabling '--clean' will have the same effect, right?
Author
Owner

@eduardolat commented on GitHub (Sep 15, 2024):

The only difference between backups with and without --clean option is that the --clean option will "clean" the database before restoring the backup, the rest is the same.

Read more at: https://www.postgresql.org/docs/current/app-pgdump.html

<!-- gh-comment-id:2351346877 --> @eduardolat commented on GitHub (Sep 15, 2024): The only difference between backups with and without `--clean` option is that the `--clean` option will "clean" the database before restoring the backup, the rest is the same. Read more at: https://www.postgresql.org/docs/current/app-pgdump.html
Author
Owner

@hdjsadgfwtg commented on GitHub (Sep 15, 2024):

Got it, thank you very much for your help, I really appreciate it!

<!-- gh-comment-id:2351349148 --> @hdjsadgfwtg commented on GitHub (Sep 15, 2024): Got it, thank you very much for your help, I really appreciate it!
Author
Owner

@Persil090 commented on GitHub (Sep 15, 2024):

Thanks for clarifying, I will try to restore again with PGBackWeb as per comment above and let you know.
Thanks again. I really hope this will work as the tool is amazing

<!-- gh-comment-id:2351457604 --> @Persil090 commented on GitHub (Sep 15, 2024): Thanks for clarifying, I will try to restore again with PGBackWeb as per comment above and let you know. Thanks again. I really hope this will work as the tool is amazing
Author
Owner

@eduardolat commented on GitHub (Sep 16, 2024):

You are welcome, i'm here waiting for your comments

<!-- gh-comment-id:2351965910 --> @eduardolat commented on GitHub (Sep 16, 2024): You are welcome, i'm here waiting for your comments
Author
Owner

@Persil090 commented on GitHub (Sep 20, 2024):

You are welcome, i'm here waiting for your comments

Just wanted to confirm that by following eduardolat instructions above i was able to restore the database (i needed to create clean database with same name but without any tables) and then execute restore into that clean table.

Thanks a lot!!

<!-- gh-comment-id:2363540592 --> @Persil090 commented on GitHub (Sep 20, 2024): > You are welcome, i'm here waiting for your comments Just wanted to confirm that by following eduardolat instructions above i was able to restore the database (i needed to create clean database with same name but without any tables) and then execute restore into that clean table. Thanks a lot!!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#33
No description provided.