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

Unable to execute script on Windows #147

Closed rp0007 closed 3 years ago

rp0007 commented 3 years ago

Running the Perl script on Windows 2012 to migrate SQL database to PostgreSQL

Installed - Perl Interpreter - Strawberry Perl.

While executing sqlserver2pgsql.pl getting following errors and not able to get before_script / after_script and unsure_script.

It is giving following errors -

D:\EDB\sqlserver2pgsql-master>perl sqlserver2pgsql.pl -nr -f MsSQL_MasterDB_Export.sql -b before_script -a after_script -u unsure_script Bareword found where operator expected at sqlserver2pgsql.pl line 1483, near "s/[[]]/"/gr" syntax error at sqlserver2pgsql.pl line 1483, near "s/[[]]/"/gr" BEGIN not safe after errors--compilation aborted at sqlserver2pgsql.pl line 4878.

D:\EDB\sqlserver2pgsql-master>

I don't see any issue with the script to replace the square brackets with quotes here. Do you see any compatibility issue.

Our main objective is to migrate one of our SQL database to PostgreSQL.

Let know if you think any issues here.

beaud76 commented 3 years ago

The error message looks strange to me: both \ characters from the line 1483 have disappeared. We should see something like: near s/[[]]/"/gr May be it's coming from the execution on Windows. Could you try to change the regexp on line 1483 with: s/[|]/"/gr;

rp0007 commented 3 years ago

Tried but still facing same error. We are running it on Windows Environment as majority of our applications hosted on Windows. Not sure if any specific change required specifically for windows.

madtibo commented 3 years ago

Hello @rp0007

First of all and to make sure the problem is with perl on windows, could you check that the escaped characters in your script are correct? For the line 1483, you should read in your script:

                    my $codequoted = $code =~ s/[\[\]]/"/gr;
                                                 ^ ^
                                         2 backslashes

We are not familiar with perl on Windows. If your script is correct, we have no clue why the escaped character fails.

If you could use a perl docker, it might solves your problem.
You can check the project docker file and adapt it to your needs.
If docker is not an option, could you try using a Linux virtualBox?

Cordialement,

madtibo commented 3 years ago

I close this issue. Do not hesitate to reopen it if you still experience your problem.