Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tiHw6-00DzmY-L4 for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2025 18:58:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tiHw4-00Cg67-Nd for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2025 18:58:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tiHus-00CaaR-94 for pgsql-general@lists.postgresql.org; Wed, 12 Feb 2025 18:56:59 +0000 Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tiHup-000U9g-2y for pgsql-general@postgresql.org; Wed, 12 Feb 2025 18:56:58 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 2F79E11400FF; Wed, 12 Feb 2025 13:56:54 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Wed, 12 Feb 2025 13:56:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1739386614; x=1739473014; bh=jvu2k13+LiL0oKx9ADngXmqxVR1wTXSdUfjc/1FjJm0=; b= QXgEguk33ZZ6cwr9qcWq3CCQWvT3EJMX0vbgEKa1A+D5or4xTPJzpZzmZipEJzOT OuEvfPlBxT7dnjIxcpS2QzN87SXV4ci55UqqoG/2rQGze/ZK3SY2YxO+5JwcBgl7 cmX99ayHOeMFmK0ItzVfW7008ec1xu/eV4FC2RLMM85tY+Zpm615VM+EjVe8vwKY xT79+UMorg5hbAYSTRFBG8RHWEtJaZePy3S8a/kocBVRKvaVOP4DMs+PRZGMBznN 4EQRNFy2sQNcP/PCOCZLmT8Fd8+3xLqSxKuj6jB3x1uuSxB9Dl6bOnAN9LS8trMT LHVkDArvGIhMCf7bFQHbuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1739386614; x=1739473014; bh=j vu2k13+LiL0oKx9ADngXmqxVR1wTXSdUfjc/1FjJm0=; b=0DkGWckm3xkLF7d2h yXHCAp8ZHdlisO5uX8F1wY7WN3KStLh8CyTmx9LLLfr0DFzYlruDW/LKmcQEcQAD GiXWyg4O/05yyqx3MDXNAfXBaK+utqN7RFEFW4Haksao8kqH93ycUtJBxeP71yTh zZklD8zgjH4jYsb15HgfpR9QbpOuqiesqUHAITxHjRIVFFvnr4StkCbaaH9sndgg FjhlwTTtvkgRJtW/VbhnZ69p9mG9Gv2EoiZEdKEYFVNJmOUbixR5En9jWQhMecJh d5DlKVROdlrJssJMzhdGR0KNhUgK2AVOeZwbnsVsfQ9Hx7sgpu2g5ifUb0f30FvM DHEvQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeggeeihecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepkeefheduvdejiefgieef jedtudduffelvdefleehfedtieffuefgvdekleegtddvnecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsg gprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehrshhhvghp rghrugesrghpphhlqdgvtghoshihshdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvg hnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Feb 2025 13:56:53 -0500 (EST) Message-ID: Date: Wed, 12 Feb 2025 10:56:52 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: psql command line editing To: Rich Shepard , pgsql-general@postgresql.org References: <61255ab-6249-1226-7db6-4ecc3e4c127b@appl-ecosys.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: <61255ab-6249-1226-7db6-4ecc3e4c127b@appl-ecosys.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/12/25 10:50, Rich Shepard wrote: > My web searches suggest that using the psql command line I'm limited to > moving the cursor one character at a time. Is there a way to use a small > editor, e.g., joe on linux, to move by words or to the begining and end of > the line? From: https://www.postgresql.org/docs/current/app-psql.html "\e or \edit [ filename ] [ line_number ] If filename is specified, the file is edited; after the editor exits, the file's content is copied into the current query buffer. If no filename is given, the current query buffer is copied to a temporary file which is then edited in the same fashion. Or, if the current query buffer is empty, the most recently executed query is copied to a temporary file and edited in the same fashion. If you edit a file or the previous query, and you quit the editor without modifying the file, the query buffer is cleared. Otherwise, the new contents of the query buffer are re-parsed according to the normal rules of psql, treating the whole buffer as a single line. Any complete queries are immediately executed; that is, if the query buffer contains or ends with a semicolon, everything up to that point is executed and removed from the query buffer. Whatever remains in the query buffer is redisplayed. Type semicolon or \g to send it, or \r to cancel it by clearing the query buffer. Treating the buffer as a single line primarily affects meta-commands: whatever is in the buffer after a meta-command will be taken as argument(s) to the meta-command, even if it spans multiple lines. (Thus you cannot make meta-command-using scripts this way. Use \i for that.) If a line number is specified, psql will position the cursor on the specified line of the file or query buffer. Note that if a single all-digits argument is given, psql assumes it is a line number, not a file name. " > > TIA, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com