I have reviewed your code and looks good to me. Can we change the message from "The database name is inappropriate" to some meaningful message, so that user should know why it is inappropriate. If user will be able to create database with "=" in name then why Backup, Maintenance and Restore fails.
Just curious, as I understand the problem, we're not able to able to run pg_dump/pg_restore/psql against the database, which contains '=' in the name.
Can we use PGDATABASE environment variable for them?
This way we can implement, but should we consider this way only in case of the database name having "=" ?
I think - we should do it for all for consistent result.
Also, the command on the dialogue will not have database name, so user might get confused.
What need to show as the command line is upto us?
We can also show PGDATABASE=XXXX as environment variable for this command.
Cost vs. benefit; how many people actually use = in their database names, and of those, how many will back it up using pgAdmin? My guess is that number is zero, or extremely close to it - and we've only ever had the issue reported by our own QA people who are intentionally trying to break this stuff.
Let's just not support external tools on any objects with = in their names. If there are complaints from users in the future, we can revisit.
Of course - this tools may still fail when special characters (e.g. '=') exists in the name of the database objects (e.g. schema, table, etc).