Bacula-users

Re: [Bacula-users] converting from MySQL to Postgresql

2010-06-22 14:49:53
Subject: Re: [Bacula-users] converting from MySQL to Postgresql
From: Martin Simmons <martin AT lispworks DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 22 Jun 2010 19:47:13 +0100
>>>>> On Tue, 22 Jun 2010 05:26:18 -0500, Jon Schewe said:
> 
> I've seen quite a bit of discussion on this on the list. It seems
> possible, so I figured I'd try. I'm using a combination of
> http://www.bacula.org/manuals/en/catalog/catalog/Installi_Configur_PostgreS.html#1107
> and
> http://www.mail-archive.com/bacula-users AT lists.sourceforge DOT 
> net/msg40993.html
> 
> I did
> mysqldump -t -n -c --compatible=postgresql --skip-quote-names --skip-opt
> --disable-keys --lock-tables -u bacula -ppass bacula
> 
> cat bacula-backup.dmp | sed -e 's/0000-00-00 00:00:00/1970-01-01
> 00:00:00/g' > fixed-bacula-backup.sql
> psql -h localhost -U bacula bacula fixed-bacula-backup.sql
> 
> Then tried to import fixed-bacula-backup.sql into the postgresql tables
> created by the bacula setup scripts. Things went along pretty well until
> I ran into this:
> 2010-06-21 22:55:01 CDT bacula bacula WARNING:  nonstandard use of
> escape in a string literal at character 89
> 2010-06-21 22:55:01 CDT bacula bacula HINT:  Use the escape string
> syntax for escapes, e.g., E'\r\n'.
> 2010-06-21 22:55:01 CDT bacula bacula ERROR:  invalid byte sequence for
> encoding "SQL_ASCII": 0x00
> 2010-06-21 22:55:01 CDT bacula bacula HINT:  This error can also happen
> if the byte sequence does not match the encoding expected by the server,
> which is controlled by "client_encoding".
> 2010-06-21 22:55:01 CDT bacula bacula STATEMENT:  INSERT INTO Log
> (LogId, JobId, Time, LogText) VALUES (456892,5599,'1969-12-31
> 18:00:01','jon-fd JobId 5599: -rw-rw-r--   1 33       video       727636
> 2010-02-14 14:51:04 
> /mnt/mybook//home/httpd/html/gallery/albums/osseo1994/DSC_0066_066.jpg\n\0');

Does every line in the Log table contain the \n and/or \0 at the end of the
text?  That might be a bug.

1969-12-31 is a rather old timestamp on that log entry too :-)

Simple solution: remove all of the "INSERT INTO Log" lines from the import.
The rows aren't required for most uses of Bacula.


> and then:
> 2010-06-21 23:01:15 CDT bacula bacula ERROR:  duplicate key value
> violates unique constraint "status_pkey"
> 2010-06-21 23:01:15 CDT bacula bacula STATEMENT:  INSERT INTO Status
> (JobStatus, JobStatusLong, Severity) VALUES ('p','Waiting on higher
> priority jobs',15);

You can remove the Status table from the import because it is created and
filled by the make_postgresql_tables script.

__Martin

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users