Index: include/utils/misc.h
===================================================================
--- include/utils/misc.h	(revision 8227)
+++ include/utils/misc.h	(working copy)
@@ -247,14 +247,10 @@
     PGICON_PUBLIC
 };
 
+// File/directory name cleanup
+wxString sanitizePath(const wxString &path);
+wxString commandLineCleanOption(const wxString &option, bool schemaObject=false);
 #endif // PGSCLI
 
 #endif
 
-#if !defined(PGSCLI)
-
-// File/directory name cleanup
-wxString sanitizePath(const wxString &path);
-wxString commandLineCleanOption(const wxString &option);
-
-#endif // PGSCLI
Index: frm/frmBackupServer.cpp
===================================================================
--- frm/frmBackupServer.cpp	(revision 8227)
+++ frm/frmBackupServer.cpp	(working copy)
@@ -147,7 +147,7 @@
         cmd += wxT(" --host ") + server->GetName();
 
     cmd +=  wxT(" --port ") + NumToStr((long)server->GetPort())
-         +  wxT(" --username ") + commandLineCleanOption(server->GetUsername());
+         +  wxT(" --username ") + commandLineCleanOption(qtIdent(server->GetUsername()));
     return cmd;
 }
 
Index: frm/frmBackup.cpp
===================================================================
--- frm/frmBackup.cpp	(revision 8227)
+++ frm/frmBackup.cpp	(working copy)
@@ -297,7 +297,7 @@
         cmd += wxT(" --host ") + server->GetName();
 
     cmd +=  wxT(" --port ") + NumToStr((long)server->GetPort())
-         +  wxT(" --username ") + commandLineCleanOption(server->GetUsername());
+         +  wxT(" --username ") + commandLineCleanOption(qtIdent(server->GetUsername()));
 
     if (object->GetConnection()->GetIsGreenplum())
         cmd += wxT(" --gp-syntax ");
@@ -400,20 +400,15 @@
                     // The syntax changed in 8.2 :-(
                     if (pgAppMinimumVersion(backupExecutable, 8, 2))
                     {
-#ifdef WIN32
                         tmpTables.Append(wxT(" --table ") + 
-                              commandLineCleanOption(wxT("\"") +ctvObjects->GetItemText(schema) +
-                                    wxT("\".\"") + ctvObjects->GetItemText(table) + wxT("\"\"")));
-#else
-                        tmpTables.Append(wxT(" --table ") +
-                              commandLineCleanOption(wxT("'") + ctvObjects->GetItemText(schema) +
-                                   wxT(".") + ctvObjects->GetItemText(table) + wxT("'")));
-#endif
+                                    commandLineCleanOption(qtIdent(ctvObjects->GetItemText(schema)), true) +
+                                    wxT(".") +
+                                    commandLineCleanOption(qtIdent(ctvObjects->GetItemText(table)), true));
                     }
                     else
                     {
-                        tmpTables.Append(wxT(" --table ") + commandLineCleanOption(ctvObjects->GetItemText(table)));
-                        tmpTables.Append(wxT(" --schema ") + commandLineCleanOption(ctvObjects->GetItemText(schema)));
+                        tmpTables.Append(wxT(" --table ") + commandLineCleanOption(qtIdent(ctvObjects->GetItemText(table)), true));
+                        tmpTables.Append(wxT(" --schema ") + commandLineCleanOption(qtIdent(ctvObjects->GetItemText(schema)), true));
                     }
                 }
                 else
@@ -430,11 +425,7 @@
             }
             else
             {
-#ifdef WIN32
-                cmdSchemas.Append(wxT(" --schema ") + commandLineCleanOption(wxT("\"") + ctvObjects->GetItemText(schema) + wxT("\"")));
-#else
-                cmdSchemas.Append(wxT(" --schema '") + commandLineCleanOption(ctvObjects->GetItemText(schema) + wxT("'")));
-#endif
+                cmdSchemas.Append(wxT(" --schema ") + commandLineCleanOption(qtIdent(ctvObjects->GetItemText(schema)), true));
             }
         }
         else
Index: frm/frmBackupGlobals.cpp
===================================================================
--- frm/frmBackupGlobals.cpp	(revision 8227)
+++ frm/frmBackupGlobals.cpp	(working copy)
@@ -162,7 +162,7 @@
         cmd += wxT(" --host ") + server->GetName();
 
     cmd +=  wxT(" --port ") + NumToStr((long)server->GetPort())
-         +  wxT(" --username ") + commandLineCleanOption(server->GetUsername());
+         +  wxT(" --username ") + commandLineCleanOption(qtIdent(server->GetUsername()));
     return cmd;
 }
 
Index: frm/frmRestore.cpp
===================================================================
--- frm/frmRestore.cpp	(revision 8227)
+++ frm/frmRestore.cpp	(working copy)
@@ -400,19 +400,19 @@
             switch (object->GetMetaType())
             {
                 case PGM_FUNCTION:
-                    cmd.Append(wxT(" --function ") + commandLineCleanOption(object->GetFullName()));
+                    cmd.Append(wxT(" --function ") + commandLineCleanOption(qtIdent(object->GetFullName()), true));
                     break;
                 case PGM_INDEX:
-                    cmd.Append(wxT(" --index ") + commandLineCleanOption(object->GetQuotedIdentifier()));
+                    cmd.Append(wxT(" --index ") + commandLineCleanOption(object->GetQuotedIdentifier(), true));
                     break;
                 case PGM_SCHEMA:
-                    cmd.Append(wxT(" --schema ") + commandLineCleanOption(object->GetQuotedIdentifier()));
+                    cmd.Append(wxT(" --schema ") + commandLineCleanOption(object->GetQuotedIdentifier(), true));
                     break;
                 case PGM_TABLE:
-                    cmd.Append(wxT(" --table ") + commandLineCleanOption(object->GetQuotedIdentifier()));
+                    cmd.Append(wxT(" --table ") + commandLineCleanOption(object->GetQuotedIdentifier(), true));
                     break;
                 case PGM_TRIGGER:
-                    cmd.Append(wxT(" --trigger ") + commandLineCleanOption(object->GetQuotedIdentifier()));
+                    cmd.Append(wxT(" --trigger ") + commandLineCleanOption(object->GetQuotedIdentifier(), true));
                     break;
                 default:
                     break;
Index: utils/misc.cpp
===================================================================
--- utils/misc.cpp	(revision 8227)
+++ utils/misc.cpp	(working copy)
@@ -1238,35 +1238,50 @@
     return wxEmptyString;
 }
 
-// Fixup a (quoted) string for use on the command line
-wxString commandLineCleanOption(const wxString &option)
+/**
+ * FUNCTION: commandLineCleanOption
+ * INPUTS:
+ *       option       - input string needs to be reformatted
+ *       schemaObject - Is this an object related to schema?
+ * PURPOSE:
+ *  - Fixup a (double-quoted) string for use on the command line
+ *
+ *    1. Schema objects needs three (slash & double-quote) combination
+ *       instead of a double-quote to be used as a command-line option
+ *    2. Options other than the schema objects needs (slash & double-quote)
+ *       combination instead of a double-quote to be used as a command-line
+ *       option.
+ *
+ *    i.e. CASE: Dump a table named em"p and database name tes"t having username
+ *         xy\z. The command-line arguments for these values will be as below:
+ *
+ *         pg_dump --username "xy\\z" --table public."em\"\"\"p" "tes\"t"
+ *
+ */
+wxString commandLineCleanOption(const wxString &option, bool schemaObject)
 {
-    wxString tmp;
-    bool wasQuoted = false;
+    wxString tmp = option;
 
+	// Only double-quoted string needs to be formatted
     if (option.StartsWith(wxT("\"")) && option.EndsWith(wxT("\"")))
     {
         tmp = option.AfterFirst((wxChar)'"').BeforeLast((wxChar)'"');
-        wasQuoted = true;
-    }
-    else
-        tmp = option;
 
-#ifdef __WXMSW__
-    if (wasQuoted)
-        tmp.Replace(wxT("\"\""), wxT("\"\"\""));
-    else
-    {
-        tmp.Replace(wxT("\""), wxT("\"\""));
+        // Replace single splash to double-splash
         tmp.Replace(wxT("\\"), wxT("\\\\"));
-    }
-#else
-    tmp.Replace(wxT("\\"), wxT("\\\\"));
-    tmp.Replace(wxT("\"\""), wxT("\\\""));
-#endif
 
-    if (wasQuoted)
+        // Replace double-quote with slash & double-quote
+        tmp.Replace(wxT("\""), wxT("\\\""));
+
+        if (!schemaObject)
+            // Replace double (slash & double-quote) combination to single (slash & double-quote) combination
+            tmp.Replace(wxT("\\\"\\\""), wxT("\\\""));
+		else
+			// Replace double (slash & double-quote) combination to triple (slash & double-quote) combination
+			tmp.Replace(wxT("\\\"\\\""), wxT("\\\"\\\"\\\""));
+
         tmp = wxT("\"") + tmp + wxT("\"");
+	}
 
     return tmp;
 }
