From 691d651679046189be7e9662bb180af2906b65ac Mon Sep 17 00:00:00 2001 From: Anton Ageev Date: Wed, 10 Dec 2008 08:30:35 +0300 Subject: [PATCH] Remove \0 from string data. Replace '0000-00-00 00:00' date/datetime to '1970-01-01 00:00'. --- mysql2psql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql2psql b/mysql2psql index 9dba587..58ceb60 100755 --- a/mysql2psql +++ b/mysql2psql @@ -446,7 +446,7 @@ class PostgresDbWriter < PostgresWriter next end if row[index].is_a?(Mysql::Time) - row[index] = row[index].to_s + row[index] = row[index].to_s.gsub('0000-00-00 00:00', '1970-01-01 00:00') next end @@ -459,7 +459,7 @@ class PostgresDbWriter < PostgresWriter if column_type(column) == "bytea" row[index] = PGconn.quote(row[index]) else - row[index] = row[index].gsub(/\\/, '\\\\\\').gsub(/\n/,'\n').gsub(/\t/,'\t').gsub(/\r/,'\r') + row[index] = row[index].gsub(/\\/, '\\\\\\').gsub(/\n/,'\n').gsub(/\t/,'\t').gsub(/\r/,'\r').gsub(/\0/, '') end end end -- 2.1.4