Skip to content

MySQL to Postgres Data Only with Truncate target table not truncating table before loading. #1591

Description

@hcpatel
  • pgloader --version
pgloader version "3.6.9"
compiled with SBCL 2.3.8
  • did you test a fresh compile from the source tree?

No.

  • did you search for other similar issues?

Yes.

  • how can I reproduce the bug?

Load file with:

 LOAD DATABASE
    FROM mysql://<connection string>
    INTO postgresql://<connection string>


 WITH data only, truncate, disable triggers, downcase identifiers, reset sequences,
      workers = 8, concurrency = 1, prefetch rows = 500, batch rows = 500,
      single reader per thread, on error stop

  • pgloader output you obtain
2024-06-26T12:12:52.888381-04:00 LOG report summary reset
                                         table name     errors       read   imported      bytes      total time       read      write
---------------------------------------------------  ---------  ---------  ---------  ---------  --------------  ---------  ---------
                                    fetch meta data          0        109        109                     0.201s
                                  Drop Foreign Keys          0          0          0                     0.000s
                                           Truncate          0         53         53                     0.255s
---------------------------------------------------  ---------  ---------  ---------  ---------  --------------  ---------  ---------

I see it indicated 'Truncate' , but I suspect table is not being truncated as subsequently the COPY fails with 'Duplicate Primary key constraint violation'.
After the run I still see the old rows in the table.

  • data that is being loaded, if relevant

  • How the data is different from what you expected, if relevant

I am looking to migrate data only, the script failed, on re-running was expecting it to 'detect there is data in the target table on postgres and expecting it to truncate the table prior to running the COPY of the data.

Is there a way to DUMP/Log the SQL pgloader runs for 'truncate'? so I can verify the '53 truncates' it indicates above?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions