Re: Correct handling of blank/commented lines in PSQL interactive-mode history

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Дата
Msg-id 3210474.1631042185@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Correct handling of blank/commented lines in PSQL interactive-mode history  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: Correct handling of blank/commented lines in PSQL interactive-mode history  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Список pgsql-hackers
[ this is a digression from the main point of the thread, but ... ]

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> I am particularly bothered by the uselessness
> that M-# results in -- namely, inserting a # at the start of the buffer.

Fixing that might be as simple as the attached.  I've not beat on
it hard though.

            regards, tom lane

diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index f926bc98dc..1dcd95a7b9 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -353,8 +353,13 @@ initializeInput(int flags)
 
         useReadline = true;
 
-        /* these two things must be done in this order: */
+        /* set appropriate values for Readline's global variables */
         initialize_readline();
+
+        /* set comment-begin to a useful value for SQL */
+        (void) rl_variable_bind("comment-begin", "-- ");
+
+        /* this reads ~/.inputrc, so do it after rl_variable_bind */
         rl_initialize();
 
         useHistory = true;

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gavin Flower
Дата:
Сообщение: Re: Data loss when '"json_populate_recorset" with long column name
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Don't clean up LLVM state when exiting in a bad way