Re: [Bacula-users] postgres createdb for bacula fails

2021-05-05 Thread kjohnson
Here's how I solved my problem, at least for now.  This approached was
inspired by the helpful replies I received, though it does not exactly
replicate any of them.

I took these steps on the test system:

aptitude remove bacula-common bacula-common-pgsql bacula-console
bacula-director bacula-director-pgsql
aptitude purge  bacula-common bacula-common-pgsql bacula-console
bacula-director bacula-director-pgsql,

when given the option during the purge command, delete all data.

aptitude install bacula-common bacula-common-pgsql bacula-console
bacula-director bacula-director-pgsql

This creates an (almost) empty bacula database with encoding SQL_ASCII.  As
user postgres, rename that database.  

ALTER DATABASE bacula RENAME TO btemplate;

Then, use the renamed database as a template to create new empty bacula
databases as needed during iterative development and testing of my sqlite to
postgres migration process.  As user postgres,

CREATE DATABASE bacula WITH TEMPLATE btemplate;

Then a command along the lines of

su - -s /bin/bash -c 'time psql bacula mailto:kjohn...@eclypse.org] 
Sent: Tuesday, May 04, 2021 5:15 PM
To: 'bacula-users'
Subject: Re: [Bacula-users] postgres createdb for bacula fails

All,

I want to thank Michel Figgins, Dan Langille, Dimitri Maziuk, and Serio
Gelato for replying to my request for help.

I'm working on it, but a variety of circumstances mean it will probably be a
couple of days before I have results.

Thanks.

Ken

-Original Message-
From: kjohn...@eclypse.org [mailto:kjohn...@eclypse.org] 
Sent: Monday, May 03, 2021 5:17 PM
To: 'bacula-users'
Subject: [Bacula-users] postgres createdb for bacula fails

As time permits, I am working on an sqlite to postgres conversion of a
bacula database, in preparation for upgrading from Debian 9 to Debian 10.
For a variety of reasons I believe I am pretty close.  But...

There are three systems involved:  the live server (Debian 9), the system
where the database conversion occurs, and a test system (Debian 9) that I am
using to confirm to the extent possible that the database conversion has
been successful.

The next step in my testing is to create an empty bacula database on the
test system and restore it from the pg_dump file created on the conversion
system.  I have learned that the bacula postgres database needs to have
encoding SQL_ASCII.  

Here's the difficulty.  As user bacula on the test system:

$ export LC_ALL=C
$ createdb -E SQL_ASCII -T template0 bacula
createdb: database creation failed: ERROR:  encoding "SQL_ASCII" does not
match locale "en_US.UTF-8"
DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".

Probably, fixing this is something that everyone else knows.  Unfortunately,
my Google searches find too much or almost nothing.  A specific search of
the mailing list archive found a discussion of why SQL_ASCII was so
important (circa 2009), but not an answer to this problem.  At least, not
one that I recognized.  (same failure without the export, by the way).  The
documentation for Bacula 7.4
(https://www.bacula.org/7.4.x-manuals/en/main/Installing_Configuring_Post.ht
ml) also states that SQL_ASCII is essential, but I did not recognize a
solution to this problem there.

bacula 7.4.4
postgres 9.6

A solution to this problem, or a fairly tight direction to the relevant
documentation would be very much appreciated.  Thanks in advance for your
attention.

Ken




___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users



___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users



___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] postgres createdb for bacula fails

2021-05-04 Thread kjohnson
All,

I want to thank Michel Figgins, Dan Langille, Dimitri Maziuk, and Serio
Gelato for replying to my request for help.

I'm working on it, but a variety of circumstances mean it will probably be a
couple of days before I have results.

Thanks.

Ken

-Original Message-
From: kjohn...@eclypse.org [mailto:kjohn...@eclypse.org] 
Sent: Monday, May 03, 2021 5:17 PM
To: 'bacula-users'
Subject: [Bacula-users] postgres createdb for bacula fails

As time permits, I am working on an sqlite to postgres conversion of a
bacula database, in preparation for upgrading from Debian 9 to Debian 10.
For a variety of reasons I believe I am pretty close.  But...

There are three systems involved:  the live server (Debian 9), the system
where the database conversion occurs, and a test system (Debian 9) that I am
using to confirm to the extent possible that the database conversion has
been successful.

The next step in my testing is to create an empty bacula database on the
test system and restore it from the pg_dump file created on the conversion
system.  I have learned that the bacula postgres database needs to have
encoding SQL_ASCII.  

Here's the difficulty.  As user bacula on the test system:

$ export LC_ALL=C
$ createdb -E SQL_ASCII -T template0 bacula
createdb: database creation failed: ERROR:  encoding "SQL_ASCII" does not
match locale "en_US.UTF-8"
DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".

Probably, fixing this is something that everyone else knows.  Unfortunately,
my Google searches find too much or almost nothing.  A specific search of
the mailing list archive found a discussion of why SQL_ASCII was so
important (circa 2009), but not an answer to this problem.  At least, not
one that I recognized.  (same failure without the export, by the way).  The
documentation for Bacula 7.4
(https://www.bacula.org/7.4.x-manuals/en/main/Installing_Configuring_Post.ht
ml) also states that SQL_ASCII is essential, but I did not recognize a
solution to this problem there.

bacula 7.4.4
postgres 9.6

A solution to this problem, or a fairly tight direction to the relevant
documentation would be very much appreciated.  Thanks in advance for your
attention.

Ken




___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users



___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] postgres createdb for bacula fails

2021-05-03 Thread dmitri maziuk

On 2021-05-03 7:38 PM, Dan Langille wrote:

On Mon, May 3, 2021, at 6:16 PM, kjohn...@eclypse.org wrote:



DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".




$ createdb -E SQL_ASCII -T template0 bacula
$ dropdb bacula
$ export LC_ALL=C
$ createdb -E SQL_ASCII -T template0 bacula
$

Works there. I suspect it is something specific to the environment.


I guess freebsd doesn't set LC_CTYPE? Postgres falls back on LC_ALL only 
if that (and IIRC some *LANG* too) isn't set.


Dima


___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] postgres createdb for bacula fails

2021-05-03 Thread Dan Langille
On Mon, May 3, 2021, at 6:16 PM, kjohn...@eclypse.org wrote:

> The next step in my testing is to create an empty bacula database on the
> test system and restore it from the pg_dump file created on the conversion
> system.  I have learned that the bacula postgres database needs to have
> encoding SQL_ASCII.  

For what it's worth, SQL_ASCII was decided upon many years ago.

> Here's the difficulty.  As user bacula on the test system:
> 
> $ export LC_ALL=C
> $ createdb -E SQL_ASCII -T template0 bacula
> createdb: database creation failed: ERROR:  encoding "SQL_ASCII" does not
> match locale "en_US.UTF-8"
> DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".
> 
> Probably, fixing this is something that everyone else knows.  Unfortunately,
> my Google searches find too much or almost nothing.  A specific search of
> the mailing list archive found a discussion of why SQL_ASCII was so
> important (circa 2009),

The decision was made earlier I think.

> but not an answer to this problem.  At least, not
> one that I recognized.  (same failure without the export, by the way).  The
> documentation for Bacula 7.4
> (https://www.bacula.org/7.4.x-manuals/en/main/Installing_Configuring_Post.ht
> ml) also states that SQL_ASCII is essential, but I did not recognize a
> solution to this problem there.

I think the problem is more PostgreSQL & environment specific. Here is my test
on FreeBSD 12.2 with PostgreSQL 12.6 - these commands are run as the postgres
user:

$ createdb -E SQL_ASCII -T template0 bacula
$ dropdb bacula
$ export LC_ALL=C
$ createdb -E SQL_ASCII -T template0 bacula
$ 

Works there. I suspect it is something specific to the environment.

What do you have for this value?

$ echo $locale

$ 


-- 
  Dan Langille
  d...@langille.org


___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


[Bacula-users] postgres createdb for bacula fails

2021-05-03 Thread kjohnson
As time permits, I am working on an sqlite to postgres conversion of a
bacula database, in preparation for upgrading from Debian 9 to Debian 10.
For a variety of reasons I believe I am pretty close.  But...

There are three systems involved:  the live server (Debian 9), the system
where the database conversion occurs, and a test system (Debian 9) that I am
using to confirm to the extent possible that the database conversion has
been successful.

The next step in my testing is to create an empty bacula database on the
test system and restore it from the pg_dump file created on the conversion
system.  I have learned that the bacula postgres database needs to have
encoding SQL_ASCII.  

Here's the difficulty.  As user bacula on the test system:

$ export LC_ALL=C
$ createdb -E SQL_ASCII -T template0 bacula
createdb: database creation failed: ERROR:  encoding "SQL_ASCII" does not
match locale "en_US.UTF-8"
DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".

Probably, fixing this is something that everyone else knows.  Unfortunately,
my Google searches find too much or almost nothing.  A specific search of
the mailing list archive found a discussion of why SQL_ASCII was so
important (circa 2009), but not an answer to this problem.  At least, not
one that I recognized.  (same failure without the export, by the way).  The
documentation for Bacula 7.4
(https://www.bacula.org/7.4.x-manuals/en/main/Installing_Configuring_Post.ht
ml) also states that SQL_ASCII is essential, but I did not recognize a
solution to this problem there.

bacula 7.4.4
postgres 9.6

A solution to this problem, or a fairly tight direction to the relevant
documentation would be very much appreciated.  Thanks in advance for your
attention.

Ken




___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users