bestinslot-xyz / OPI

Open Protocol Indexer, OPI, is the best-in-slot open-source indexing client for meta-protocols on Bitcoin.
Apache License 2.0
202 stars 110 forks source link

Allow other database users to restore backups. #19

Closed jaxonly closed 7 months ago

jaxonly commented 8 months ago

In the current script, using a non-postgres user will result in restore failure.

This error is usually caused by attempting to restore a backup file that contains settings for specific roles.

Adding --no-owner will make it successful and ensure that subsequent synchronization can proceed normally.

pg_restore: processing item 225 SEQUENCE block_hashes_id_seq
pg_restore: creating SEQUENCE "public.block_hashes_id_seq"
pg_restore: from TOC entry 225; 1259 41204 SEQUENCE block_hashes_id_seq postgres
pg_restore: error: could not execute query: ERROR: must be able to SET ROLE "postgres"
Command was: ALTER SEQUENCE public.block_hashes_id_seq OWNER TO postgres;

pg_restore: processing item 3449 SEQUENCE OWNED BY block_hashes_id_seq
pg_restore: creating SEQUENCE OWNED BY "public.block_hashes_id_seq"
pg_restore: processing item 224 TABLE ord_content
pg_restore: creating TABLE "public.ord_content"
pg_restore: from TOC entry 224; 1259 41194 TABLE ord_content postgres
pg_restore: error: could not execute query: ERROR: must be able to SET ROLE "postgres"
Command was: ALTER TABLE public.ord_content OWNER TO postgres;

pg_restore: processing item 223 SEQUENCE ord_content_id_seq
pg_restore: creating SEQUENCE "public.ord_content_id_seq"
pg_restore: from TOC entry 223; 1259 41193 SEQUENCE ord_content_id_seq postgres
pg_restore: error: could not execute query: ERROR: must be able to SET ROLE "postgres"
Command was: ALTER SEQUENCE public.ord_content_id_seq OWNER TO postgres;