dimitri / pgloader

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

MATERIALIZE VIEWS does not work for MySQL #1565

Closed gokhankiyga closed 8 months ago

gokhankiyga commented 8 months ago

LOAD DATABASE FROM mysql://root:password@localhost/tpch INTO postgresql://postgres:password@localhost/tpch_replica WITH CREATE NO TABLES

INCLUDING ONLY TABLE NAMES LIKE 'lineitem','orders'

ALTER TABLE NAMES matching 'pgorders_view' rename to 'pgorders'

MATERIALIZE VIEWS 'pgorders_view' AS $$ select l.L_ORDERKEY,l.L_LINENUMBER,l.L_QUANTITY,l.L_DISCOUNT, l.L_TAX,l.L_SHIPDATE,l.L_RECEIPTDATE,l.L_SHIPMODE,o.O_ORDERDATE,o.O_ORDERSTATUS from tpch.lineitem l join tpch.orders o on l.L_ORDERKEY = o.O_ORDERKEY; $$ ;

These code throws error : KABOOM! ESRAP-PARSE-ERROR: At

MATERIALIZE VIEWS 'pgord ^ (Line 11, Column 0, Position 294)

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 character ; (SEMICOLON) or the string "after" or the string "alter" or the string "before" or the string "cast" or the string "excluding" or the string "including" or the string "set" or the string "with" I CANT UNDERSTAND WHY? Also; According to the documentation including only table names matching is used for filtering the table but pgloader throws error to ask to use like rather than matching. I did not understand that also. After changing matching to like it jump the error.

gokhankiyga commented 8 months ago

Versions of tools: pgloader version "3.6.9" compiled with SBCL 2.3.4 PostgreSQL 16.2 Mysql 8.3.0

gokhankiyga commented 8 months ago

If your password contains @ character pgloader detects mysql connectionn as sqlite so It ask Like rather than matching and does not understand MATERIALIZE VIEW keyword.