Hello,

The right choice is to create the database in SQL_ASCII, the only
difference with UTF8 is that Postgresql will do extra checks and abort
transactions if a filename has a non valid utf8 character, and it
happens a lot. Asking the users to configure their systems correctly or
get rid of these files is an illusion.

If you use the correct options while creating the database, postgres
will do the SQL_ASCII and everything will work correctly.

Thanks,
Best Regards,
Eric


> Le 25 août 2025 à 15:34, Jonas Jelten <[email protected]> a écrit :
> 
> The code does check for having SQL_ASCII encoding explicitly, and the
> reasoning I can find for this is:
> 
> The docs say at https://www.bacula.org/de/dev-
> manual/Installi_Configur_PostgreS.html#SECTION002820000000000000000 :
> 
> This script creates the PostgreSQL bacula database. Before running this
> command, you should carefully think about what encoding sequence you
> want for the text fields (paths, files, ...). Ideally, the encoding
> should be set to UTF8. However, many Unix systems have filenames that
> are not encoded in UTF8, either because you have not set UTF8 as your
> default character set or because you have imported files from elsewhere
> (e.g. MacOS X). For this reason, Bacula uses SQL_ASCII as the default
> encoding. If you want to change this, please modify the script before
> running it.
> 
> The code says:
> 
> src/win32/cats/create_postgresql_database.cmd says:
> 
> REM use SQL_ASCII to be able to put any filename into
> REM  the database even those created with unusual character sets
> SET ENCODING=ENCODING 'SQL_ASCII'
> 
> REM use UTF8 if you are using standard Unix/Linux LANG specifications
> REM  that use UTF8 -- this is normally the default and *should* be
> REM  your standard.  Bacula consoles work correctly *only* with UTF8.
> REM SET ENCODING=ENCODING 'UTF8'
> 
> 
> src/cats/create_postgresql_database.in says:
> 
> # use SQL_ASCII to be able to put any filename into
> #  the database even those created with unusual character sets
> [...]
> #  We do not recommend that you use ENCODING 'SQL_UTF8'
> #  It can result in creating filenames in the database that
> #  cannot be seen or restored.
> 
> 
> -> UTF8 is the encouraged standard, but the default is SQL_ASCII.
> 
> => This is all a bit contradicting.
>   Maybe getting rid of the warning under the assumption all backed up 
> filenames are UTF8 is the right choice?
> 
> -- 
> You received this bug notification because you are subscribed to bacula
> in Ubuntu.
> https://bugs.launchpad.net/bugs/2121318
> 
> Title:
>  Fresh install of director: Warning: Encoding error for database
>  "bacula". Wanted SQL_ASCII, got UTF8
> 
> Status in bacula package in Ubuntu:
>  Triaged
> 
> Bug description:
>  I did a fresh install of bacula-directory from questing,
>  15.0.3-3ubuntu1, and got the following messages at the bacula console
>  and via email to root@localhost:
> 
>  Message 1:
>  From [email protected]  Sun Aug 24 17:38:31 2025
>  X-Original-To: root
>  From: (Bacula) <[email protected]>
>  Subject: Bacula daemon message
>  Sender: [email protected]
>  To: [email protected]
>  Date: Sun, 24 Aug 2025 17:38:31 +0000 (UTC)
> 
>  24-Aug 17:38 bacula-dir JobId 0: Warning: Encoding error for database 
> "bacula". Wanted SQL_ASCII, got UTF8
>  24-Aug 17:38 bacula-dir JobId 0: Warning: Encoding error for database 
> "bacula". Wanted SQL_ASCII, got UTF8
> 
>  The postgresql database are:
>  root@q-bacula-dir:~# sudo -u postgres psql -l
>                                                   List of databases
>     Name    |  Owner   | Encoding | Locale Provider | Collate |  Ctype  | 
> Locale | ICU Rules |   Access privileges
>  
> -----------+----------+----------+-----------------+---------+---------+--------+-----------+-----------------------
>   bacula    | bacula   | UTF8     | libc            | C.UTF-8 | C.UTF-8 |     
>    |           |
>   postgres  | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |     
>    |           |
>   template0 | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |     
>    |           | =c/postgres          +
>             |          |          |                 |         |         |     
>    |           | postgres=CTc/postgres
>   template1 | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |     
>    |           | =c/postgres          +
>             |          |          |                 |         |         |     
>    |           | postgres=CTc/postgres
>  (4 rows)
> 
>  Maybe there is still a reference to SQL_ASCII somewhere in the config,
>  or code.
> 
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/bacula/+bug/2121318/+subscriptions
>

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2121318

Title:
  Fresh install of director: Warning: Encoding error for database
  "bacula". Wanted SQL_ASCII, got UTF8

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bacula/+bug/2121318/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to