Restore fails - Postgres database with dash ("-") in name

Virtualmin version 5.04.gpl

Virtual server created, postgresql data base created with dash character ("-") in name.

Server works well, backups work well.

Went to restore backup, restore failed with message

Restore failed : SQL alter database mydbname-test2 owner to postgres failed : ERROR: syntax error at or near "-" LINE 1: alter database mydbname-test2 owner to postgres ^

(actual dbname text before "-" changed for this bug report)

Status: 
Active

Comments

That's odd, as Virtualmin should convert - to _ in database names that it creates.

If you create a test domain named like my-test.com on your system with PostgreSQL enabled, what is the name of the database that gets associated with it?

It's not Virtualmin's fault

Creating the test domain my-test.com with PostgreSQL enabled created a database my_test.com as expected.

I found a workaround to make the restore work by checking the "ignore errors" checkbox on the "show what will be restored" page.

Then, reading "Virtualmin should convert - to _ in database names that it creates" I realized what caused the issue.

I installed a software package that has the capability of creating additional databases. The original databases were created with "_" in the names. Later, using the create database feature of that package, I created another (fortunately a database with only test data in it) with "-" in the name.

I've subsequently deleted the testing database with the "-" in the name.

Ah .. and then you imported this database into Virtualmin? That would explain it..