Restoring Postgresql DB backup with different owner role

Like the title says, when restoring a Postgresql database onto a different server which happens to have a dfferent role owner, extra care is needed, otherwise similar error message below will come up: pg_restore: from TOC entry 217; 1259 17163 TABLE users_collections webdev1 pg_restore: error: could not execute query: ERROR: role "webdev1" does not exist Command was: ALTER TABLE public.users_collections OWNER TO webdev1; pg_restore: from TOC entry 218; 1259 17168 TABLE users_organizations webdev1 pg_restore: error: could not execute query: ERROR: role "webdev1" does not exist Command was: ALTER TABLE public....

July 3, 2022 · 1 min · 213 words · kenno