Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUX9C-0001wD-Jb for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Apr 2021 16:04:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUX9B-0006T8-IL for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Apr 2021 16:04:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUX9B-0006T1-C6 for pgsql-bugs@lists.postgresql.org; Thu, 08 Apr 2021 16:04:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUX94-000769-PZ for pgsql-bugs@lists.postgresql.org; Thu, 08 Apr 2021 16:04:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 138G4ZuJ1883669; Thu, 8 Apr 2021 12:04:35 -0400 From: Tom Lane To: robin.knipe@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16956: psql won't load command history In-reply-to: <16956-2d64781689d887c1@postgresql.org> References: <16956-2d64781689d887c1@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 08 Apr 2021 15:00:22 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1883667.1617897875.1@sss.pgh.pa.us> Date: Thu, 08 Apr 2021 12:04:35 -0400 Message-ID: <1883668.1617897875@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > Running the `psql` command from docker (postgres:12-alpine), fails to load > the `.psql_history` command contents. Strangely, the session's commands ARE > SAVED though! Also I can read the history contents in the psql session, as > the following raw output shows: > ``` > levqa=> \echo `echo $PSQL_HISTORY` > /.psql_history > levqa=> \echo `tail $PSQL_HISTORY` > _HiStOrY_V2_ > _HiStOrY_V2_ > _HiStOrY_V2_ > _HiStOrY_V2_ > echo\040HISTCONTROL\012; > `echo\040HISTCONTROL`\012; > \134echo\040:HISTCONTROL > \134echo\040:HISTFILE > \134set\040HISTFILE\040/.psql_history > \134echo\040:HISTFILE > levqa=> > ``` No concrete ideas to offer, but I'm pretty sure that that history-file format is only supposed to have one "_HiStOrY_V2_" marker line at the start. Maybe getting rid of the extras would de-confuse it. Anyway, none of Postgres' own code touches that file. If there's a bug here, it's in libedit. regards, tom lane