Submitted by sfbob on Thu, 09/01/2016 - 20:19
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
Submitted by sfbob on Thu, 09/01/2016 - 20:23 Comment #1
Submitted by sfbob on Fri, 09/02/2016 - 00:47 Comment #2
Submitted by sfbob on Fri, 09/02/2016 - 00:48 Comment #3
Submitted by JamieCameron on Fri, 09/02/2016 - 01:16 Comment #4
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?Submitted by sfbob on Fri, 09/02/2016 - 04:14 Comment #5
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.
Submitted by JamieCameron on Fri, 09/02/2016 - 20:53 Comment #6
Ah .. and then you imported this database into Virtualmin? That would explain it..