ERROR: relation "assetindexdata_id_seq" already exists on new database I'm using PostgreSQL locally and everything is working as expected. However, when I decided to move/restore the database to the staging environment I am getting this error (even through the tables do not exist).

Has anyone experienced this before?

restore_pg_11.0: [archiver (db)] could not execute query: ERROR:  relation "assetindexdata_id_seq" already exists
    Command was: CREATE SEQUENCE public.assetindexdata_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
Not sure how the database backup was created and what's being used to restore it, but using this would fix the error:

CREATE SEQUENCE IF NOT EXISTS 'public.assetindexdata_id_seq'


Alternatively, if you delete the database to destroy all of the associated metadata, then it shouldn't matter.

https://www.postgresql.org/docs/9.5/sql-createsequence.html