pgloader icon indicating copy to clipboard operation
pgloader copied to clipboard

cast not taking effect

Open SlimJUC opened this issue 3 years ago • 0 comments

  • [ ] pgloader --version

    <3.6.3>
    
  • [ ] did you test a fresh compile from the source tree?

Yes

  • [ ] did you search for other similar issues? Yes
  • [ ] how can I reproduce the bug?
--
--

LOAD DATABASE
     FROM      mysql://test:1q2w3e4r@localhost/test
     INTO     pgsql:///db_migrated

 WITH include drop, create tables

ALTER SCHEMA 'test' RENAME TO 'public'

CAST
    type timestamp when default "CURRENT_TIMESTAMP"
      to timestamptz drop default drop not null
          using zero-dates-to-null,
    type timestamp to timestamptz drop default drop not null
          using zero-dates-to-null
;

  • [ ] pgloader output you obtain
postgres@ubuntu-c-8-16gib-ams3-01:/tmp$ pgloader test.load 
2022-02-07T23:50:42.010000Z LOG pgloader version "3.6.3~devel"
2022-02-07T23:50:42.061000Z LOG Migrating from #<MYSQL-CONNECTION mysql://test@localhost:3306/test {100811BF73}>
2022-02-07T23:50:42.061000Z LOG Migrating into #<PGSQL-CONNECTION pgsql://postgres@UNIX:5432/db_migrated {100811CB53}>
2022-02-07T23:51:45.200000Z ERROR Database error 22007: invalid input syntax for type timestamp with time zone: "current_timestamp(1)"
QUERY: CREATE TABLE public.customers_wallet_3 
(
  wallet_id          bigserial not null,
  customer_id        bigint not null,
  store_vendor_id    bigint default NULL,
  amount             decimal(15,3) not null,
  wallet_type        boolean not null default 't',
  customer_notified  boolean not null default 'f',
  notify_type        boolean not null default 'f',
  sale_id            bigint default NULL,
  commission         float default NULL,
  gateway_commission decimal(3,3) not null default '0.000',
  payment_method_id  bigint default NULL,
  invoice_id         varchar(100) default NULL,
  payment_status     varchar(20) default 'pending',
  notes              varchar(100) not null,
  added_date         timestamptz not null default 'current_timestamp(1)',
  use_type           boolean not null default 'f',
  expiry_date        date default NULL
);
2022-02-07T23:51:45.254000Z FATAL Failed to create the schema, see above.
2022-02-07T23:51:45.257000Z LOG report summary reset
       table name     errors       rows      bytes      total time
-----------------  ---------  ---------  ---------  --------------
  fetch meta data          0      11310                    25.767s
   Create Schemas          0          0                     0.001s
 Create SQL Types          0         40                     0.025s
    Create tables          0          0                     0.000s
-----------------  ---------  ---------  ---------  --------------
-----------------  ---------  ---------  ---------  --------------

SlimJUC avatar Feb 08 '22 00:02 SlimJUC