Error passing script from Firebird database to Postgresql

Asked

Viewed 221 times

0

I’m trying to pass a script for creating and inserting data from a Firebird database to Postgresql, but in some tables there is a syntax error, I am using the SQL Manager Interbase & Firebird tool to generate *.sql files from my Firebird database tables. I have tried via CMD to send the files to the bank through the following command:

psql -h host -p 5432 -U postgres -d database -f (File location *.sql)

but the following error returns me:

psql:C:/Backup/Script/CONTROLEIMPRESSOES.sql:573: ERROR: column "DATA" is of type date but expression is of type integer LINHA 6: (163, 6, 2007-02-01, 29138, 31432, 2294, 160.58, 31388, 33...)

DICA: You will need to rewrite or cast the expression

inserir a descrição da imagem aqui

So I went through pgAdmin and the only way to insert this into the bank was to put the date between "2007-02-01".

My question is, how can I generate a *.sql file where dates already come in parentheses, so you don’t need to change row by row by adding "" on each date.

1 answer

1


If you have the same structure in both banks and are migrating from one to the other, you may be using the tool Fullcopyconvert which is paid for but I think the trial version can help you.

If it is a process to be executed a few times you can use a text editor with regular expression support and add quotes on the dates, so you wouldn’t need to do it manually on each line. You can use the Notepad++ and use the replace option as in the image below:

Regex Notepad++

  • Thanks for the Notepad++ tip, if it fit perfectly for what I needed

Browser other questions tagged

You are not signed in. Login or sign up in order to post.