Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d79KK-0003L6-8l for pgsql-bugs@arkaria.postgresql.org; Sat, 06 May 2017 23:41:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d79KJ-0000PY-Pm for pgsql-bugs@arkaria.postgresql.org; Sat, 06 May 2017 23:41:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d79Jc-0007dG-6p for pgsql-bugs@postgresql.org; Sat, 06 May 2017 23:40:44 +0000 Received: from mail.aegee.org ([144.76.142.78]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d79JU-00011C-SW for pgsql-bugs@postgresql.org; Sat, 06 May 2017 23:40:43 +0000 Authentication-Results: aegeeserv.aegee.org; auth=pass (PLAIN) smtp.auth=didopalauzov DKIM-Filter: OpenDKIM Filter v2.10.3 mail.aegee.org v46Nfrt1007667 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aegee.org; s=k4096; t=1494114114; i=dkim+MSA-tls@aegee.org; r=y; bh=vu291rS9wUjB95HfAHsTAb/NADluDEKfImpeh9bBtys=; h=Subject:Cc:References:From:Date:In-Reply-To; b=FEMP9JnGQrah4lBh9i0h47UEqlMVdkmBnjXGLbA4+HwqsJwRhq1mk8rJ+2JQg2rko d3eSq5s7gH4UbqkZrhEy1kbscdGbM7zd5p0CA8iYZtpo1reZL5puI+p0a6VbD2+a8x 0fYKQPx0diem+InRXVayzUfzKlAcXF+nUYp5jegy1nwCFrh+w00jacZuTugTPwrksI JRIsJpsGSGYEw9izyk8x0F0LKlBC+zXduQVmt17KlGa7x840iTqo4JadjRiSRuzwhy g9nrQ4XzL5pB19lcnMu8PzTMzRVUMMHfhUm8Ek0rox54kKjFjJ3EfIicFtY/NMaEG7 j/jAF1xrxiLcjNrAz2vZrMNCCqtKmBtfUoupfS9o8XhdLffhH7zhsAOULYokG0M6ez KliFyfueCm1RLeFMKvNDzQjAOFLZqgxHwAFBfAqCJ/MVuomfiG/8NlL3l9vTEyqWj/ QW9qnUcpCjo6l9pimcs+WP/Vil+fZ2AZWGlyin2R7g1wBxO5dTwFiOVChFRqKMQkLX EJWsbyuu2oJZCKpTjLLWCHEBZ5r15vt89ETktdWpPW4aNq5spNXXu/OEm9rq288Lcx k72A8iMQO9+yFpz0VMAdZnJfG0FcJnGUZgWOWKg4VDaHiXtoZfVSAD5UVbHBMUCQPi 9hfCDl7PeyMQcqroXueNWxmg= Authentication-Results: mail.aegee.org; dkim=none Received: from [192.168.178.46] (x5f74ef1e.dyn.telefonica.de [95.116.239.30]) (authenticated bits=0) by mail.aegee.org (8.15.2/8.15.2) with ESMTPSA id v46Nfrt1007667 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Sat, 6 May 2017 23:41:54 GMT Subject: Re: psql history and "-- lines" Cc: pgsql-bugs@postgresql.org References: <48b3a5ac-d219-6568-6751-260b1387bc37@aegee.org> <19006.1494033923@sss.pgh.pa.us> <7127.1494112662@sss.pgh.pa.us> From: =?UTF-8?B?0JTQuNC70Y/QvSDQn9Cw0LvQsNGD0LfQvtCy?= Message-ID: <01e0355e-381e-9732-7d4e-cbd0e6bfa710@aegee.org> Date: Sun, 7 May 2017 01:40:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <7127.1494112662@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99.2 at mail.aegee.org X-Virus-Status: Clean X-Pg-Spam-Score: -1.0 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hello, the comment-begin should be useful in psql, even if the user has not explicitly set comment-begin to be usefull (--): Change comment-begin, if it has the libreadline default value: diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index 2359b11dcd..93da7f7c75 100644 --- 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(); Greetings Дилян On 05/07/2017 01:17 AM, Tom Lane wrote: > =?UTF-8?B?0JTQuNC70Y/QvSDQn9Cw0LvQsNGD0LfQvtCy?= writes: >> I expect that psql and the shell, e.g. bash, behave in the same way in >> regards to history logs and until-the-current-line comments. > > I do not think that the shell necessarily provides a gold-plated precedent > for us to follow. The language syntax it's dealing with is substantially > different from SQL. Even ignoring that point, there are a lot of shell > implementations with a lot of different interactive behaviors; who's to > say that bash is the one true way? > >> + rl_variable_bind("comment-begin", "--"); > > Interesting thought, but IIUC that's a setting that would be better left > to the user's ~/.inputrc, or might indeed override something he's put > there. I'm also dubious how well it works across all the versions of > readline and libedit that are out there. > > Perhaps we could document suggested settings for people to put into > ~/.inputrc: > > $if psql > set comment-begin "-- " > ... other things? > $endif > > > regards, tom lane > -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs