Skip to content

Invalid docs for default MYSql to Postgres migration at Casting rules #1676

@FluffyDiscord

Description

@FluffyDiscord

Hi, I need to change the default datetime cast rules. However simply copying them to .load fails with parsing error.

My load

LOAD DATABASE
	FROM mysql://db:[email protected]:12826/db
	INTO postgresql://db:[email protected]:5433/db
WITH
    create indexes, uniquify index names, foreign keys,
    include drop,
    reset sequences, multiple readers per thread,
    workers = 8, concurrency = 2, rows per range = 50000
 
SET PostgreSQL PARAMETERS
    maintenance_work_mem to '1GB'
 
SET MySQL PARAMETERS
    net_read_timeout  = '31536000',
    net_write_timeout = '31536000',
    lock_wait_timeout = '31536000'

CAST
    type datetime when default "0000-00-00 00:00:00" and not null
      to timestamp drop not null drop default
          using zero-dates-to-null,
    
    type datetime when default "0000-00-00 00:00:00"
      to timestamp drop default
          using zero-dates-to-null,
    
    type datetime with extra on update current timestamp when not null
      to timestamp drop not null drop default
         using zero-dates-to-null,
    
    type datetime with extra on update current timestamp
      to timestamp drop default
         using zero-dates-to-null,
    
    type timestamp when default "0000-00-00 00:00:00" and not null
      to timestamp drop not null drop default
          using zero-dates-to-null,
    
    type timestamp when default "0000-00-00 00:00:00"
      to timestamp drop default
          using zero-dates-to-null,
    
    type date when default "0000-00-00" to date drop default
          using zero-dates-to-null,

    type datetime to timestamp,
    type timestamp to timestamp
;

the error:

What I am doing here?

At

  CAST
      type datetime when default "0000-00-00 00:00:00" and not null
  
                                                      ^ (Line 19, Column 52, Position 532)

In context COMMAND:

While parsing COMMAND. Expected:

     the character Tab
  or the character Newline
  or the character Return
  or the character Space
  or the character , (COMMA)
  or the string "--"
  or the string "/*"
  or the character ; (SEMICOLON)
  or the string "after"
  or the string "alter"
  or the string "before"
  or the string "cast"
  or the string "decoding"
  or the string "distribute"
  or the string "drop"
  or the string "excluding"
  or the string "including"
  or the string "keep"
  or the string "materialize"
  or the string "set"
  or the string "to"
  or the string "using"
  or the string "when"
  or the string "with"

Relevant docs: https://pgloader.readthedocs.io/en/latest/ref/mysql.html?highlight=zero%20dates%20null#default-mysql-casting-rules

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