Re: pg_restore has problems with restoring sequences.

From: "robert(at)redo2oo(dot)ch" <robert(at)redo2oo(dot)ch>
To: robert <robert(at)redcor(dot)ch>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: pg_restore has problems with restoring sequences.
Date: 2018-02-04 16:49:21
Message-ID: 14757998-9ef0-ba73-d3f4-287f91905626@redo2oo.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks Tom
On 04.02.2018 16:43, Tom Lane wrote:
> robert <robert(at)redcor(dot)ch> writes:
>> I use
>>     pg_dump -h localhost  -U USER -Fc DATABASE > dumpfile
> OK ...
>
>> then I restore it with:
>>     dropdb DATABASE
>>     pg_restore -O  -U user  -d DATABASE  dumpfile
> That sequence is missing a createdb step (or else -C in the restore
> switches).
yes, I am using also the -C switch
sorry
>
>> doing this then I get these warnings, and many (not all) sequences are not created.
> Usually the thing to do is look at the very first error; everything after
> that may just be cascading damage. I kinda doubt what you showed us
> here is the first error.
no its not, but they are all similar, I assumed (maybe wrongly) that it makes no
difference ..
Here are the first couple:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1068; 1259 142848 SEQUENCE
change_email_domain_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or
near "AS"
LINE 2:     AS integer
            ^
    Command was: CREATE SEQUENCE change_email_domain_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALU...
pg_restore: [archiver (db)] Error from TOC entry 11717; 0 0 SEQUENCE OWNED BY
change_email_domain_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR: relation
"change_email_domain_id_seq" does not exist
    Command was: ALTER SEQUENCE change_email_domain_id_seq OWNED BY
change_email_domain.id;

pg_restore: [archiver (db)] Error from TOC entry 1062; 1259 134467 SEQUENCE
change_email_wizard_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or
near "AS"
LINE 2:     AS integer
            ^
    Command was: CREATE SEQUENCE change_email_wizard_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALU...
pg_restore: [archiver (db)] Error from TOC entry 11724; 0 0 SEQUENCE OWNED BY
change_email_wizard_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR: relation
"change_email_wizard_id_seq" does not exist
    Command was: ALTER SEQUENCE change_email_wizard_id_seq OWNED BY
change_email_wizard.id;

pg_restore: [archiver (db)] Error from TOC entry 1070; 1259 142859 SEQUENCE
delete_user_confirm_wizard_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or
near "AS"
LINE 2:     AS integer
            ^
    Command was: CREATE SEQUENCE delete_user_confirm_wizard_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO ...
pg_restore: [archiver (db)] Error from TOC entry 12169; 0 0 SEQUENCE OWNED BY
delete_user_confirm_wizard_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR: relation
"delete_user_confirm_wizard_id_seq" does not exist
    Command was: ALTER SEQUENCE delete_user_confirm_wizard_id_seq OWNED BY
delete_user_confirm_wizard.id;

pg_restore: [archiver (db)] Error from TOC entry 1066; 1259 140393 SEQUENCE
news_publish_queue_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or
near "AS"
LINE 2:     AS integer
            ^
    Command was: CREATE SEQUENCE news_publish_queue_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE...
pg_restore: [archiver (db)] Error from TOC entry 13336; 0 0 SEQUENCE OWNED BY
news_publish_queue_id_seq odoo
pg_restore: [archiver (db)] could not execute query: ERROR: relation
"news_publish_queue_id_seq" does not exist
    Command was: ALTER SEQUENCE news_publish_queue_id_seq OWNED BY
news_publish_queue.id;

thanks again
robert

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message robert 2018-02-04 16:53:28 Re: pg_restore has problems with restoring sequences.
Previous Message Tom Lane 2018-02-04 15:43:06 Re: pg_restore has problems with restoring sequences.