dalibo / sqlserver2pgsql

Migration tool to convert a Microsoft SQL Server Database into a PostgreSQL database, as automatically as possible
http://dalibo.github.io/sqlserver2pgsql
GNU General Public License v3.0
515 stars 117 forks source link

-ignore_errors flag for schema conversion as well #173

Open shubham-yb opened 1 year ago

shubham-yb commented 1 year ago

Hi Team, The current behaviour of the tool is that it errors out during schema conversion if it finds some unknown clause. Example

Cannot determine the PostgreSQL's datatype corresponding to hierarchyid. This is a bug
 at ./sqlserver2pgsql.pl line 379, <$file> line 690.
    main::convert_type('hierarchyid', undef, 'OrganizationNode', 'Employee', undef, 'HumanResources') called at ./sqlserver2pgsql.pl line 1424
    main::add_column_to_table('HumanResources', 'Employee', 'OrganizationNode', undef, 'hierarchyid', undef, undef, 'NULL') called at ./sqlserver2pgsql.pl line 1546
    main::parse_dump() called at ./sqlserver2pgsql.pl line 3316

And then it stops here without providing anything in the output files. Is there a way to skip/ignore such statements and go ahead with converting the rest?

The -ignore_errors flag exists for the data side but a similar flag during schema conversion will be a huge help.

Thank You in advance!

usyadav3001 commented 6 months ago

Hi Team, when I wiill be exicuting the below query give error how can I fix . plz help

aanchal@it-OptiPlex-5060:~/Documents/migrateDatabase$ perl sqlserver2pgsql.pl -f input_sql_dump.sql -b output_before_script -a output_after_script -u output_unsure_script Types: $VAR1 = { 'bigint' => 'bigint', 'rowversion' => 'bytea', 'xml' => 'xml', 'datetimeoffset' => 'timestamp with time zone', 'nchar' => 'char', 'nvarchar' => 'varchar', 'varbinary' => 'bytea', 'binary' => 'bytea', 'time' => 'time', 'tinyint' => 'smallint', 'float' => 'double precision', 'timestamp' => 'bytea', 'real' => 'real', 'datetime' => 'timestamp', 'int' => 'int', 'money' => 'numeric', 'uniqueidentifier' => 'uuid', 'smallint' => 'smallint', 'smallmoney' => 'numeric(6,4)', 'text' => 'text', 'date' => 'date', 'image' => 'bytea', 'varchar' => 'varchar', 'datetime2' => 'timestamp', 'decimal' => 'numeric', 'smalldatetime' => 'timestamp', 'char' => 'char' }; Cannot determine the PostgreSQL's datatype corresponding to public.xdtID. This is a bug at sqlserver2pgsql.pl line 382, <$file> line 6. main::convert_type("public.xdtID", undef, "item_id", "xtItem", undef, "public") called at sqlserver2pgsql.pl line 1445 main::add_column_to_table("public", "xtItem", "item_id", "dbo", "xdtID", undef, undef, "NOT NULL") called at sqlserver2pgsql.pl line 1567 main::parse_dump() called at sqlserver2pgsql.pl line 3338