dimitri / pgloader

Migrate to PostgreSQL in a single command!

Home Page:http://pgloader.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSSQL Materialize view is downloading all views instead of filtering & downloading only the ones passed in config.

harshagarwal001 opened this issue · comments

  • pgloader --version

    pgloader version "3.6.9"
    compiled with SBCL 2.3.8
    

PGLOADER FILE FROM MS SQL TO Postgres


load database
     from mssql://USER_NAM@SOME_IP/db
     into postgresql:///db

CAST type nvarchar to text drop typemod using remove-null-characters,
      type varchar to text drop typemod using remove-null-characters

MATERIALIZE VIEWS view1
including only table names like 'tb1' in schema 'dbo'

set work_mem to '4GB', maintenance_work_mem to '4GB'

before load do $$ drop schema if exists dbo cascade; $$,
 $$ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" $$

ALTER schema 'dbo' rename to 'public';

Expected Output:

It should port only view: "view1" but it get all the views from MS SQL.

Debugging:

I can see from query in 
```pgloader --debug ms.load```:
that query is missing 
"WHERE Clause"
it should filter using " WHERE t.TABLE_NAME IN ('view1')"
but it does not have this Clause
hence it gets all the views...

I've created a PR that addresses this:

https://github.com/dimitri/pgloader/pull/1559/files

Good luck to anyone making their migration from MSSQL to Postgres!

Thank you!!!