pgloader icon indicating copy to clipboard operation
pgloader copied to clipboard

Having issues with mysql to postgres migration with pgloader

Open shaileshmistri22 opened this issue 7 months ago • 6 comments

Receiving below error :-

postgres@zammadpostgres:~$ pgloader zammad.load 2025-07-15T13:43:01.014000Z LOG pgloader version "3.6.10~devel" KABOOM! ESRAP-PARSE-ERROR: At

LOAD SQL FILE

^ (Line 1, Column 0, Position 0)

In context COMMAND:

While parsing COMMAND. Expected:

 the character Tab

or the character Newline or the character Return or the character Space or the string "--" or the string "/*" or the string "archive" or the string "copy" or the string "csv" or the string "database" or the string "dbf" or the string "fixed" or the string "ixf" An unhandled error condition has been signalled: At

LOAD SQL FILE

^ (Line 1, Column 0, Position 0)

In context COMMAND:

While parsing COMMAND. Expected:

 the character Tab

or the character Newline or the character Return or the character Space or the string "--" or the string "/*" or the string "archive" or the string "copy" or the string "csv" or the string "database" or the string "dbf" or the string "fixed" or the string "ixf"

What I am doing here?

At

LOAD SQL FILE

^ (Line 1, Column 0, Position 0)

In context COMMAND:

While parsing COMMAND. Expected:

 the character Tab

or the character Newline or the character Return or the character Space or the string "--" or the string "/*" or the string "archive" or the string "copy" or the string "csv" or the string "database" or the string "dbf" or the string "fixed" or the string "ixf

Inspite i tried to use docker for higher version of pgloader but still getting same error

shaileshmistri22 avatar Jul 15 '25 14:07 shaileshmistri22

Hi,

I'm having a similar error.

Pgloader version (using Docker image ghcr.io/dimitri/pgloader:latest): pgloader version "3.6.10~devel" compiled with SBCL 2.2.9.debian

Context: I'm trying to migrate a Mattermost database on MySQL to PosgreSQL using the official Mattermost documentation. On Step 4 - Run pgloader, I got the error:

2025-09-29T15:31:05.048000Z LOG pgloader version "3.6.10~devel"
KABOOM!
ESRAP-PARSE-ERROR: At

  WITH data only,
      workers = 8, concurrency = 1,

                                  ^ (Line 6, Column 32, Position 218)

In context SQLITE-OPTIONS:

While parsing SQLITE-OPTIONS. Expected:

     the character Tab
  or the character Newline
  or the character Return
  or the character Space
  or the string "--"
  or the string "/*"
  or the string "batch"
  or the string "concurrency"
  or the string "create"
  or the string "data"
  or the string "disable"
  or the string "downcase"
  or the string "drop"
  or the string "encoding"
  or the string "foreign"
  or the string "include"
  or the string "max"
  or the string "no"
  or the string "on"
  or the string "prefetch"
  or the string "preserve"
  or the string "quote"
  or the string "reset"
  or the string "schema"
  or the string "snake_case"
  or the string "truncate"
  or the string "uniquify"
  or the string "workers"

For reference, my .load file is in this pastebin.

It seems that pgloader is treating the MySQL connection as a SQLite connection and uses it's syntax, resulting in the syntax error.

There's a old closed issue #1048 related to this, it might be back. Any feedback?

isaacvicente avatar Sep 29 '25 15:09 isaacvicente

Update:

Got it working by passing the flag --type mysql. Still it should work without the flag.

isaacvicente avatar Sep 29 '25 19:09 isaacvicente

@isaacvicente I'm trying to migrate mattermost as well and when I run with --type mysql I get Option "--type" is ignored when using a load file. Were you able to migrate your database?

Update:

Got it working by passing the flag --type mysql. Still it should work without the flag.

mfisch04 avatar Dec 05 '25 19:12 mfisch04

Hi guys,

An update to my comment:

The error was caused by using DNS names on top of the file. So, I guess, pgload interpret those names as file names, thus using the SQLite syntax. So, you MUST use IPs here, even if you are inside a containerized environment (i.e., use containers IPs).

Does this resolve the issue, @shaileshmistri22?

isaacvicente avatar Dec 06 '25 11:12 isaacvicente

@isaacvicente I'm trying to migrate mattermost as well and when I run with --type mysql I get Option "--type" is ignored when using a load file. Were you able to migrate your database?

@mfisch04 It was more like a workaround. Try what I said above and see if it works.

isaacvicente avatar Dec 06 '25 11:12 isaacvicente

@isaacvicente I'm trying to migrate mattermost as well and when I run with --type mysql I get Option "--type" is ignored when using a load file. Were you able to migrate your database?

@mfisch04 It was more like a workaround. Try what I said above and see if it works.

@isaacvicente I was able to get this working. I did not need to use --type, my issue was due to having an '@' in a password, so had to replace it with '@@'. I also had to turn off SSL on the postgres instance and add ?sslmode=disable to the postgres dsn. And I had to use the latest pgloader docker image (ghcr.io/dimitri/pgloader:latest). I was able to use the database DNS names and did not need to use their IP addresses. With that configuration I was able to follow the mattermost procedure. I appreciate your help!

mfisch04 avatar Dec 08 '25 20:12 mfisch04