Skip to content

Can't create database with dots in name. #1864

@Akiyamov

Description

@Akiyamov

Bareos component version

  1. bareos-dir --version: 22.1.2-r2
  2. bareos-dir --version: 22.1.2-r2
  3. bareos-sd --version 22.1.2-r2
  4. bconsole --version 22.1.2-r2

Steps to reproduce

  1. Run a create_bareos_database script with env db_name which has dots or any other special character.

Expected results

Created DB

Actual results

Info: Creating database 'infra.backup.bareos'
psql:<stdin>:2: ERROR:  syntax error at or near "."
LINE 1: CREATE DATABASE infra.backup.bareos ENCODING 'SQL_ASCII' LC_...
                             ^
Warning:  
Warning: Database encoding not conform. Do not use this database
Warning:  
Error: Creation of database 'infra.backup.bareos' failed.

Environment

- OS: `Alpine 3.20`
- component:

Relevant log output

No response

Relevant traces output

No response

Anything else?

Yes, bug report is for version 22, but i just installed bareos 23 on ubuntu and verified that this script still doesn't have quotes so it won't work in this version too. To fix this you simply need to run:

sed -ie 's|CREATE DATABASE \${db_name}|CREATE DATABASE "\${db_name}"|' /etc/bareos/scripts/create_bareos_database \
sed -ie 's|ALTER DATABASE \${db_name}|ALTER DATABASE "\${db_name}"|' /etc/bareos/scripts/create_bareos_database

I also created a MR #1865.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis addresses a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions