diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -356,6 +356,8 @@ initializeInput(int flags)
                 /* these two things must be done in this order: */
                 initialize_readline();
                 rl_initialize();
+               if (!strcmp("#", rl_variable_value("comment-begin")))
+                       rl_variable_bind("comment-begin", "--");

                 useHistory = true;
                 using_history();
