Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-08 Thread Uwe Schuerkamp
Hello Martin, thanks, this type of cast has helped with the volume names in the postgres catalog! On Wed, Sep 07, 2022 at 04:32:58PM +0100, Martin Simmons wrote: > This might work but I've not tested it: > > cast type tinyblob to text using varbinary-to-string > I've extended the CAST to

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-07 Thread Martin Simmons
> On Wed, 7 Sep 2022 12:08:10 +0200, Uwe Schuerkamp said: > > On Mon, Sep 05, 2022 at 05:14:28PM +0100, Martin Simmons wrote: > > > On Mon, 5 Sep 2022 11:21:52 +0200, Uwe Schuerkamp said: > > > > > > I've tried casting "blob" and "tinyblob" (the mariadb column types for > > > VolumeName,

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-07 Thread dmitri maziuk
On 2022-09-07 5:27 AM, Uwe Schuerkamp wrote: sql_create.c:483 Create DB Media record INSERT INTO Media

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-07 Thread Uwe Schuerkamp
On Mon, Sep 05, 2022 at 11:57:43AM -0500, dmitri maziuk wrote: > Right, I saw the starting '\x' and looked no further. OP will have to figure > out what encoding that POS is actually dumping into -- keeping in mind that > it may be the OS messing it up when saving to text file -- and then figure

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-07 Thread Uwe Schuerkamp
On Mon, Sep 05, 2022 at 05:14:28PM +0100, Martin Simmons wrote: > > On Mon, 5 Sep 2022 11:21:52 +0200, Uwe Schuerkamp said: > > > > I've tried casting "blob" and "tinyblob" (the mariadb column types for > > VolumeName, for example) to "text", but pgloader just hangs when > > including those

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-05 Thread dmitri maziuk
On 2022-09-05 11:14 AM, Martin Simmons wrote: ... I think you need convert_from(), not encode(). Something like select convert_from(VolumeName::bytea, 'SQL_ASCII') from media; Right, I saw the starting '\x' and looked no further. OP will have to figure out what encoding that POS is

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-05 Thread dmitri maziuk
On 2022-09-05 4:21 AM, Uwe Schuerkamp wrote: bacula=# select encode(VolumeName, 'hex') from media; encode 7a69662d66756c6c2d30303031 7a69662d696e63722d30303032 7a69662d696e63722d30303033 ... Is the "\xss850938sdkl" you posted before an actual

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-05 Thread Martin Simmons
> On Mon, 5 Sep 2022 11:21:52 +0200, Uwe Schuerkamp said: > > I've tried casting "blob" and "tinyblob" (the mariadb column types for > VolumeName, for example) to "text", but pgloader just hangs when > including those cast statements. What exact cast statement did you use? > > Also, Dima

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-05 Thread Wanderlei Huttel
Hello Uwe Could you send me the dumps of MySQL that script had generated? Best regards *Wanderlei Hüttel* Em seg., 5 de set. de 2022 às 06:21, Uwe Schuerkamp < uwe.schuerk...@nionex.net> escreveu: > Hi folks, > > I've now tried to migrate my mariadb bacula db to postgres using > Wanderlei's

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-05 Thread Uwe Schuerkamp
Hi folks, I've now tried to migrate my mariadb bacula db to postgres using Wanderlei's scripts linked below. Sadly I end up with the same "hex value" volume names in the media table. :.( It looks like newer mariadb / mysql catalogs might require some extra steps to enable a successful migration

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-02 Thread Wanderlei Huttel
Thanks Radosław! Best regards *Wanderlei Hüttel* Em sex., 2 de set. de 2022 às 06:40, Radosław Korzeniewski < rados...@korzeniewski.net> escreveu: > Hi, > > śr., 31 sie 2022 o 01:14 Wanderlei Huttel > napisał(a): > >> Hello Uwe >> >> I've made a script to migrate MySQL/MariaDB to PostgreSQL

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-02 Thread Radosław Korzeniewski
Hi, śr., 31 sie 2022 o 01:14 Wanderlei Huttel napisał(a): > Hello Uwe > > I've made a script to migrate MySQL/MariaDB to PostgreSQL > > https://github.com/wanderleihuttel/bacula-utils/tree/master/convert_mysql_to_postgresql > > I've found errors only in the Log table. > I've looked for chars

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-01 Thread dmitri maziuk
On 2022-09-01 7:57 AM, Uwe Schuerkamp wrote: ... So I'm wondering why "text" would end up displayed as "hex" in bconsole? Because it's a hex text, presumably ;) This is likely happening when pulling the data out of mysql, not when displaying it in bconsole. You could try `select

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-01 Thread Martin Simmons
Yes, that's what I meant. With the default casts, pgloader will convert those fields to binary and use hex-encoded strings in the SQL (https://www.postgresql.org/docs/current/datatype-binary.html#id-1.5.7.12.9). Since the actual PostgreSQL field type is text, the encoded strings are then inserted

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-01 Thread Wanderlei Huttel
Hello Uwe I found a document on the internet about pgloader. Maybe it would be necessary to make a cast of the fields. https://pgloader.readthedocs.io/en/latest/ref/mysql.html#mysql-database-casting-rules Best regards *Wanderlei Hüttel* Em qui., 1 de set. de 2022 às 10:00, Uwe Schuerkamp <

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-01 Thread Uwe Schuerkamp
On Thu, Sep 01, 2022 at 01:01:31PM +0100, Martin Simmons wrote: > The volume name above is "zif-incr-0019" if you decode the hex, so it looks > like you need to add some translation from the various BLOB types to text in > the pgloader configuration if that is possible. By default, pgloader

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-01 Thread Martin Simmons
> On Thu, 1 Sep 2022 09:38:08 +0200, Uwe Schuerkamp said: > > I've now used the bacula provided scripts to create the database, > tables and grants and have reloaded the catalog using this gploader > file: > > LOAD DATABASE > FROM mysql://bacula:vampyre2020k@localhost/bacula > INTO

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-09-01 Thread Uwe Schuerkamp
Hi folks, On Tue, Aug 30, 2022 at 03:53:47PM +0100, Martin Simmons wrote: > Bacula will probably not work if pgloader created the schema. I think you > should do that part with Bacula's make_postgresql_tables script and configure > pgloader to keep that schema (i.e. the opposite of most of the

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-30 Thread Wanderlei Huttel
Hello Uwe I've made a script to migrate MySQL/MariaDB to PostgreSQL https://github.com/wanderleihuttel/bacula-utils/tree/master/convert_mysql_to_postgresql I've found errors only in the Log table. I've looked for chars with wrong encoding and make an update in MySQL, did a dump and import again

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-30 Thread Charles Tassell
Hi Uwe,   I think Martin was right with this one.  You are probably going to have to edit the export file from mysqldump to remove the inserts for tables that the Postgres schema maker creates automatically.  To make this easier, so you don't have to recreate the schema each time, you can

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-30 Thread Martin Simmons
> On Tue, 30 Aug 2022 16:04:08 +0200, Uwe Schuerkamp said: > > Hello Charles, > > thanks for "INSERT only" idea... it's worked partially. After removing > some double quotes and other characters using sed psql didn't like, > the import runs for a while and then stops with the following

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-30 Thread dmitri maziuk
On 2022-08-30 9:04 AM, Uwe Schuerkamp wrote: INSERT 0 6 ERROR: duplicate key value violates unique constraint "status_pkey" DETAIL: Key (jobstatus)=(A) already exists. Any idea what could be causing this? Without looking at the actual DDL, I'd say your tables are wrong and primary key

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-30 Thread Martin Simmons
> On Mon, 29 Aug 2022 08:28:31 +0200, Uwe Schuerkamp said: > Mail-Followup-To: Uwe Schuerkamp , > > On Thu, Aug 25, 2022 at 06:57:46PM +0100, Martin Simmons wrote: > > Do you have non-ASCII characters in your volume, job or client names? If > > not, > > then I don't see why the warning

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-30 Thread Uwe Schuerkamp
Hello Charles, thanks for "INSERT only" idea... it's worked partially. After removing some double quotes and other characters using sed psql didn't like, the import runs for a while and then stops with the following error: INSERT 0 6 ERROR: duplicate key value violates unique constraint

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-29 Thread Charles Tassell
Hi Uwe,   You might want to try just dumping the data as full inserts and then import it with pgsql.  IE: mysqldump -nc bacula |grep INSERT >output.sql psql bacula \. output.sql Another option wqould be to use the --default-character-set option to mysqldump to switch the output to just

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-29 Thread Uwe Schuerkamp
Hello Eric, thanks much for your reply. On Thu, Aug 25, 2022 at 03:36:09PM +0200, Eric Bollengier via Bacula-users wrote: > > Bacula might have to store characters coming from the different clients > (filename and > > path mostly), and we have no guarantee that they will be in valid UTF8. >

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-29 Thread Uwe Schuerkamp
On Thu, Aug 25, 2022 at 06:57:46PM +0100, Martin Simmons wrote: > Do you have non-ASCII characters in your volume, job or client names? If not, > then I don't see why the warning would cause them to look quite funny > (whatever that means). > > __Martin Hi folks, thanks for your answers. No, I

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-25 Thread Martin Simmons
> On Thu, 25 Aug 2022 14:25:30 +0200, Uwe Schuerkamp said: > > I've imported the bacula catalog using pgloader and this config: > > LOAD DATABASE > FROM mysql://bacula:X@localhost/bacula > INTO postgresql://bacula:X@localhost/bacula > > WITH include drop, create tables,

Re: [Bacula-users] Migrating from mariadb to postgresql

2022-08-25 Thread Eric Bollengier via Bacula-users
Hello Uwe, On 25.08.22 14:25, Uwe Schuerkamp wrote: Hi folks, I'm trying (for educational purposes) to migrate an existing bacula catalog to use with a postgres backend (mariadb10 / postgresql12, Ubuntu 20.04). I've imported the bacula catalog using pgloader and this config: LOAD DATABASE

[Bacula-users] Migrating from mariadb to postgresql

2022-08-25 Thread Uwe Schuerkamp
Hi folks, I'm trying (for educational purposes) to migrate an existing bacula catalog to use with a postgres backend (mariadb10 / postgresql12, Ubuntu 20.04). I've imported the bacula catalog using pgloader and this config: LOAD DATABASE FROM mysql://bacula:X@localhost/bacula INTO

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread George Anchev via Bacula-users
Great. Thanks again Martin. -- George ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread George Anchev via Bacula-users
On Mon, 19 Nov 2018 17:29:21 GMT Martin Simmons wrote: > rpm -qf ...path..to..libpq.so... # rpm -qf /usr/lib64/libpq.so postgresql10-devel-10.5-lp150.3.3.1.x86_64 How do I use this info? -- George ___ Bacula-users mailing list

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread Martin Simmons
> On Mon, 19 Nov 2018 19:04:06 +0200, George Anchev via Bacula-users said: > > Thanks for clarifying. My only concern is to be able > to backup and restore correctly files with non-ASCII > names (e.g. UTF-8 or anything that the file systems > support). Yes, that's exactly what using

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread Martin Simmons
> On Mon, 19 Nov 2018 19:00:55 +0200, George Anchev via Bacula-users said: > > Same empty output. The libpq files must be in some other package then. If you have found the .so file then you can check what owns it by rpm -qf ...path..to..libpq.so... __Martin

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread George Anchev via Bacula-users
On Mon, 19 Nov 2018 11:32:24 GMT Martin Simmons wrote: > SQL_ASCII [...] Thanks for clarifying. My only concern is to be able to backup and restore correctly files with non-ASCII names (e.g. UTF-8 or anything that the file systems support). -- George

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread George Anchev via Bacula-users
On Mon, 19 Nov 2018 10:40:42 GMT Martin Simmons wrote: > Sorry, I meant -ql rather than -qi. Same empty output. -- George ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread Martin Simmons
> On Mon, 19 Nov 2018 01:24:18 +0200, George Anchev via Bacula-users said: > > On Fri, 16 Nov 2018 12:50:12 +0200 George Anchev wrote: > > > https://www.bacula.org/9.2.x-manuals/en/main/Installing_Configuring_Post.html > > Can anyone please explain why SQL_ASCII is strongly > recommended?

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-19 Thread Martin Simmons
> On Sat, 17 Nov 2018 00:25:17 +0200, George Anchev via Bacula-users said: > > On Fri, 16 Nov 2018 18:15:43 GMT Martin Simmons wrote: > > > rpm -qi postgresql | grep libpq > > That shows empty output. Sorry, I meant -ql rather than -qi. __Martin

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-18 Thread Wanderlei Huttel
Hello George. I don't know why, but I guess is the default charset of Bacula with PostgreSQL. I had troubles with "Log" table when had Windows Jobs with errors. But how I only had a few errors, I updated some informations in the MySQL Catalog manually (using update), and generate this single

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-18 Thread George Anchev via Bacula-users
On Fri, 16 Nov 2018 12:50:12 +0200 George Anchev wrote: > https://www.bacula.org/9.2.x-manuals/en/main/Installing_Configuring_Post.html Can anyone please explain why SQL_ASCII is strongly recommended? Won't that be a problem for unicode file names? -- George

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-18 Thread George Anchev via Bacula-users
On Sat, 17 Nov 2018 11:39:46 -0600 Dmitri Maziuk via Bacula-users wrote: > As per the fine manual: create bacula role, create > bacula tables, etc. OK, I have done that. The problem is that the manual seems not to be so fine as the process described further there results in errors which make it

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-17 Thread Dmitri Maziuk via Bacula-users
On 11/17/2018 10:56 AM, George Anchev via Bacula-users wrote: # systemctl status postgresql starts the service. In the 'status' details I see: /usr/lib/postgresql10/bin/postgres -D /var/lib/pgsql/data So from here: How should I proceed with Bacula? As per the fine manual: create bacula

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-17 Thread George Anchev via Bacula-users
On Sat, 17 Nov 2018 18:56:53 +0200 George Anchev wrote: > # systemctl status postgresql > > starts the service. Correction: I mean "start" (not "status") -- George ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-17 Thread George Anchev via Bacula-users
# systemctl status postgresql starts the service. In the 'status' details I see: /usr/lib/postgresql10/bin/postgres -D /var/lib/pgsql/data So from here: How should I proceed with Bacula? -- George ___ Bacula-users mailing list

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-17 Thread George Anchev via Bacula-users
On Sat, 17 Nov 2018 08:55:27 -0600 Dmitri Maziuk via Bacula-users wrote: > It may be that you need to run 'pg_ctl initdb' to > get it all created. $ pg_ctl initdb pg_ctl: no database directory specified and environment variable PGDATA unset Try "pg_ctl --help" for more information. -- George

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-17 Thread Dmitri Maziuk via Bacula-users
On 11/17/2018 5:37 AM, George Anchev via Bacula-users wrote: On Fri, 16 Nov 2018 17:46:13 -0600 Dimitri Maziuk via Bacula-users wrote: Well, that's b0rk3d. What can be done about it? You'd have to ask suse. It may be that you need to run 'pg_ctl initdb' to get it all created. Dimitri

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-17 Thread George Anchev via Bacula-users
On Fri, 16 Nov 2018 17:46:13 -0600 Dimitri Maziuk via Bacula-users wrote: > Well, that's b0rk3d. What can be done about it? > This is probably it. Check > ~postgres/data/pg_hba.conf as per previous message: > specifically, if auth method is "ident", it won't > work without identd server. "peer"

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread Dimitri Maziuk via Bacula-users
On 11/16/2018 05:06 PM, George Anchev via Bacula-users wrote: >> -bash-4.2$ echo $PGDATA >> /var/lib/pgsql/data > > I get the same echo output but: > > # ls /var/lib/pgsql/data > ls: cannot access '/var/lib/pgsql/data': No such file or directory Well, that's b0rk3d. >

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread George Anchev via Bacula-users
On Fri, 16 Nov 2018 16:41:40 -0600 Dimitri Maziuk via Bacula-users wrote: > # su - postgres > Last login: Wed Jan 24 15:59:20 CST 2018 on pts/1 > -bash-4.2$ echo $PGDATA > /var/lib/pgsql/data I get the same echo output but: # ls /var/lib/pgsql/data ls: cannot access '/var/lib/pgsql/data': No

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread Dimitri Maziuk via Bacula-users
On 11/16/2018 04:25 PM, George Anchev via Bacula-users wrote: > I still wonder though why there is nothing postgresql > related in /etc... Need I install any other packages > or how should this be set up? # su - postgres Last login: Wed Jan 24 15:59:20 CST 2018 on pts/1 -bash-4.2$ echo $PGDATA

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread George Anchev via Bacula-users
On Fri, 16 Nov 2018 18:15:43 GMT Martin Simmons wrote: > rpm -qi postgresql | grep libpq That shows empty output. > Also, you may only have .so files installed, in > which case try: > > objdump -T ...path..to..libpq.so... | grep > pthread_mutex_lock > > and look for something like: > >

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread Dimitri Maziuk via Bacula-users
On 11/16/2018 12:15 PM, Martin Simmons wrote: >> On Fri, 16 Nov 2018 12:50:12 +0200, George Anchev via Bacula-users said: >> nm: '/usr/lib/libpq.a': No such file > Also, you may only have .so files installed, That is the most likely cause, many distros don't even ship .a's in -devel

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread Martin Simmons
> On Fri, 16 Nov 2018 12:50:12 +0200, George Anchev via Bacula-users said: > > and I reached the point where I got stuck with: > > # nm /usr/lib/libpq.a | grep pthread_mutex_lock > nm: '/usr/lib/libpq.a': No such file > > Am I missing something and how should I do all this > please? The

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread George Anchev via Bacula-users
On Fri, 16 Nov 2018 16:19:02 +0100 Kern Sibbald wrote: > I don't believe you need postgresql-devel, Will Bacula build '--with-postgresql' without it? > but you should have something like postgresql-client. That's what postgresql is: [~]: rpm -qi postgresql | grep -i summary Summary :

Re: [Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread Kern Sibbald
Hello, I don't believe you need postgresql-devel,  but you should have something like postgresql-client.  I am not familiar any more with SuSE, so I am just guessing at the names.   Also on .debs platforms there is a postgresql-common and postgresql-client-common, but those two packages are

[Bacula-users] Migrating from MariaDB to PostgreSQL

2018-11-16 Thread George Anchev via Bacula-users
Hi, Currently I am using Bacula 9.2.2 (06 November 2018) with MariaDB. In earlier discussions here it was recommended to use PostgreSQL instead and a link was shared about a tool which migrates MySQL to PostgreSQL: https://sourceforge.net/p/bacula/mailman/message/36387001/ I have never used and