Skip to content

Commit 3d858af

Browse files
committed
psql: initialize comment-begin setting to a useful value by default.
Readline's meta-# command is supposed to insert a comment marker at the start of the current line. However, the default marker is "#" which is entirely unhelpful for SQL. Set it to "-- " instead. (This setting can still be overridden in one's ~/.inputrc file, so this change won't affect people who have already taken steps to make the command useful.) Discussion: https://postgr.es/m/CAJcOf-cAdMVr7azeYR7nWKsNp7qhORzc84rV6d7m7knG5Hrtsw@mail.gmail.com
1 parent c2f6549 commit 3d858af

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/psql/input.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,13 @@ initializeInput(int flags)
353353

354354
useReadline = true;
355355

356-
/* these two things must be done in this order: */
356+
/* set appropriate values for Readline's global variables */
357357
initialize_readline();
358+
359+
/* set comment-begin to a useful value for SQL */
360+
(void) rl_variable_bind("comment-begin", "-- ");
361+
362+
/* this reads ~/.inputrc, so do it after rl_variable_bind */
358363
rl_initialize();
359364

360365
useHistory = true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy