With the help of pg_dumpall, I tried to dump but I am getting an error for the new line.
-- -- Database "dbstr1; dbstr 2" dump --
shell command argument contains a newline or carriage return: " dbname='dbstr1; dbstr 2'"
After this message, we are stopping the dump.
I have reproduced and verified the same.The reason is in runPgDump during appendShellString for forming the pg_dump command , in appendShellStringNoError we are considering the string as invalid if it has '\n' and '\r'.
I think, if we are allowing new lines in the db name, then we should dump it.