Restore postgresql?

I did a new fresh install with

sudo yunohost app install https://github.com/YunoHost-Apps/synapse --debug

than i tried to emty the new installed databade matrix_synapse by an ohter dump

sudo --login --user=postgres PGUSER=postgres PGPASSWORD=[the psql password] pg_dump -c matrix_synapse > matrix_synapse.sql

with the DB backup file stored inside the archive in apps/synapse/backup/dump.sql i restored with

sudo --login --user=postgres PGUSER=postgres PGPASSWORD=[the psql password] psql matrix_synapse < dump.sql

I got quid some ERRORs with something like:

relation "xyz" already exists
or
multiple primary keys for tabel "yyxxzz" ar not allowed
or
constraint "yyyxxy" for relation "zzzzd" already exists

but as I check in element as fare as I can see the restore did work and I see all my old contacts and posts…

So thanks @Aleks agian for teaching and showing me things :slight_smile:

Can i neglect this errors?

Weeeeeeell I guess if that’s working then that’s okay ¯\_(ツ)_/¯ It’s difficult to say more without the exact error message and having a Matrix dev/expert around …

synapse and element seam to work fine also with old contacts and rooms

here are the error messages :

https://paste.yunohost.org/raw/yegihopiva

maybe @Josue can have a look at it later…

I good new year 2021 to you @Aleks and to the whole yunohost community - and thanks again for your help…

1 Like

Naively I believe all the relation 'foobar' already exists are fine because we’re restoring the dump on top of an existing DB … The violates unique constraint messages are probably related to this as well and should be fine … maybe …

Maybe that one is a bit more problematic:

ERROR:  insert or update on table "destination_rooms" violates foreign key constraint "destination_rooms_destination_fkey"
DETAIL:  Key (destination)=(matrix.org) is not present in table "destinations".

but that’s really a rough guess …

If you identify issues later, could also try to do a different kind of restore that would recreate the DB from scratch (using the dump) rather than inject the dump on top of an existing db …

hmm… so how do i recreate the DB from scratch ?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.