psql and readline comments - Mailing list pgsql-bugs

From Дилян Палаузов
Subject psql and readline comments
Date
Msg-id b10ba6a38a7f02207ccd0a848c620d7176149e46.camel@aegee.org
Whole thread Raw
Responses Re: psql and readline comments  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hello,

please consider integrating making the usual readilne binding M-# do in psql what users expect from it: insert comment
at the beginning of the line.  See for patch:

https://www.postgresql.org/message-id/01e0355e-381e-9732-7d4e-cbd0e6bfa710@aegee.org

At 
https://www.postgresql.org/message-id/0afcbc3f-8c1c-c576-824a-5cc02e5a81e5@2ndquadrant.com was suggested to postpone
this for PG11.  Now you can integrate this on the master branch.


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();


Regards
  Дилян



pgsql-bugs by date:

Previous
From: leif@lako.no
Date:
Subject: Re: BUG #15589: Due to missing wal, restore ends prematurely andopens database for read/write
Next
From: Tom Lane
Date:
Subject: Re: psql and readline comments