dimitri / pgloader

Migrate to PostgreSQL in a single command!
http://pgloader.io
Other
5.45k stars 548 forks source link

MYSQL to Postgres : reset sequence not working #1598

Open signmeuptwice opened 4 months ago

signmeuptwice commented 4 months ago

In the following load file if I remove the CAST then I can insert a new record in my database after migration. If I have the CAST inserting a new record results in error duplicate id

LOAD DATABASE
    FROM      mysql://root:root@database/dev
    INTO      pgsql://app:pass@postgres/dev

    WITH include drop, create tables, create indexes, reset sequences,
    workers = 8, concurrency = 1,
    multiple readers per thread, rows per range = 50000

    SET PostgreSQL PARAMETERS
        maintenance_work_mem to '128MB',
        work_mem to '12MB',
        search_path to 'mr_dev, public, "$user"'

    CAST column article.emoji to jsonb,
         column post.emoji to jsonb

    ALTER SCHEMA 'dev' RENAME TO 'public'

    BEFORE LOAD DO
    $$ create schema if not exists dev; $$;
mschmiedel commented 1 month ago

I guess this happens also from sqlite, can observe a similar behavior...