Bacula-users

Re: [Bacula-users] PostgreSQL: import of DB from MySQL fails

2013-01-06 17:03:27
Subject: Re: [Bacula-users] PostgreSQL: import of DB from MySQL fails
From: Dan Langille <dan AT langille DOT org>
To: Wolfgang Denk <wd AT denx DOT de>
Date: Sun, 6 Jan 2013 17:00:29 -0500
On Jan 6, 2013, at 2:16 PM, Wolfgang Denk wrote:

> Dear Dan,
> 
> In message <078A8CA8-46CC-46E5-AFCE-CCFDE5644FAE AT langille DOT org> you 
> wrote:
>> 
>>> But the instructions at
>>> http://www.bacula.org/manuals/en/catalog/catalog/Installi_Configur_PostgreS.html
>>> simply don't work at all (no surprise, as these appear to be more than
>>> 8 years old and refer to ancient versions.
>>> 
>>> The description recommended by Marco:
>>> http://mtu.net/~jpschewe/blog/2010/06/migrating-bacula-from-mysql-to-postgresql/
>>> appears to work much better (at least no errors so far), albeit
>>> _terribly_ slow.  I did not expect import times in the order of
>>> _weeks_.
>> 
>> I see things in there which I feel are suspect. Eg the dates; they should be 
>> null. 
> 
> Sorry for the delay - I was waiting for the import to complete.  It
> took from Dec 30 15:00 through Jan 06 10:49, i. e. nearly 7 days.  I
> will have to test how long the import of a PostgreSQL dump will take,
> hopefully it's faster (otherwise recovery after a crash of the DB
> server will be a real PITA).
> 
> So the import completet, but it threw some 300+ error messages,
> apparently for file names which have an apostrophe in their names.
> 
> For example the SQL statement:
> 
> INSERT INTO Filename (FilenameId, Name) VALUES 
> (706893,'Multichannel_DMA_API_User\'s_Guide.pdf');
> 
> will raise:
> 
> ERROR:  syntax error at or near "s_Guide"
> LINE 1: ... Name) VALUES (313896,'Multichannel_DMA_API_User\'s_Guide.pd...
>                                                             ^
> 
> Can anybody please tell me what this statement should look like so it
> gets digested by PostgrSQL?  Thanks in advance…

Here is my trial and error on PostgreSQL 8.4.13:

bacula=# begin;
BEGIN
bacula=# INSERT INTO Filename (FilenameId, Name) VALUES 
(706893,'Multichannel_DMA_API_User\'s_Guide.pdf');
WARNING:  nonstandard use of \' in a string literal
LINE 1: ...T INTO Filename (FilenameId, Name) VALUES (706893,'Multichan...
                                                             ^
HINT:  Use '' to write quotes in strings, or use the escape string syntax 
(E'...').
INSERT 0 1
bacula=# INSERT INTO Filename (FilenameId, Name) VALUES 
(706893,E'Multichannel_DMA_API_User\'s_Guide.pdf');
ERROR:  duplicate key value violates unique constraint "filename_pkey"
bacula=# rollback;
ROLLBACK
bacula=# begin;
BEGIN
bacula=# INSERT INTO Filename (FilenameId, Name) VALUES 
(706893234,E'Multichannel_DMA_API_User\'s_Guide.pdf');
INSERT 0 1
bacula=# rollback;
ROLLBACK
bacula=# 

That is, put an E before the '


> Has anybody else successfully done an update MySQL => PostgrSQL
>>> recently?
>> 
>> I would look at non-Bacula resources. What you are doing is 
>> Postgresql-specific.  
> 
> You are definitely right here.  But the hints I get there are not
> really helpful, at least not to me - I ain't no DB expert after all.


By that, I meant the PostgreSQL lists.  They often have MySQL -> PostgreSQL 
tips.

-- 
Dan Langille - http://langille.org


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>