pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: External psql editor
Date: Fri, 29 Apr 2022 15:45:26 -0700
Message-ID: <a1b5885f-0634-6324-a318-eb35ed45ec2b@aklaver.com> (raw)
In-Reply-To: <8d23a17b-ba8d-1e69-7fc5-b551f9df5252@gmail.com>
References: <edf1cfa4-35bf-66bf-4de2-7a3bbcb6c5e4@appl-ecosys.com>
	<7fef2d5f-6698-0bb5-11fe-ffd042a24ab1@wi3ck.info>
	<89e71248-2fa8-c6ee-9546-93286947ed3b@appl-ecosys.com>
	<ce8ee8c0-cb6b-c114-47be-275730af91de@wi3ck.info>
	<8d23a17b-ba8d-1e69-7fc5-b551f9df5252@gmail.com>

On 4/29/22 12:50 PM, Mladen Gogala wrote:
> On 4/29/22 13:35, Jan Wieck wrote:
>> Not that I know of. \e starts the external editor and you have to save 
>> and exit that editor to get back to psql in order to execute it. IMHO 
>> the whole construct has very limited usability.
>>
>>
>> Regards, Jan 
> 
> Is there a way to define the name of the temporary file created by \e 
> command? I'd like to name it "afiedt.buf", not for sentimental reasons. 
> I already have a cron job that cleans afiedt.buf from my home directory 
> every hour and having psql name temporary file like that would simplify 
> the cleaning process. The name comes from another database with the same 
> editor construct as \e. I am actually quite used to that.

If want to do something like that you would need to do(using VIM here):

\e
select 1;
:w afiedt.buf

or
:wq afiedt.buf

Assuming you closed the editor you could pick up the file later by doing.

\e afiedt.buf

> 
> Regards
> 
> -- 
> Mladen Gogala
> Database Consultant
> Tel: (347) 321-1217
> https://dbwhisperer.wordpress.com
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (26+ messages)  latest in thread

Message-ID: <a1b5885f-0634-6324-a318-eb35ed45ec2b@aklaver.com>
Permalink:  ../a1b5885f-0634-6324-a318-eb35ed45ec2b@aklaver.com/
Also on:    postgresql.org/message-id/a1b5885f-0634-6324-a318-eb35ed45ec2b@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, gogala.mladen@gmail.com
  Subject: Re: External psql editor
  In-Reply-To: <a1b5885f-0634-6324-a318-eb35ed45ec2b@aklaver.com>
  References: <edf1cfa4-35bf-66bf-4de2-7a3bbcb6c5e4@appl-ecosys.com> <7fef2d5f-6698-0bb5-11fe-ffd042a24ab1@wi3ck.info> <89e71248-2fa8-c6ee-9546-93286947ed3b@appl-ecosys.com> <ce8ee8c0-cb6b-c114-47be-275730af91de@wi3ck.info> <8d23a17b-ba8d-1e69-7fc5-b551f9df5252@gmail.com> <a1b5885f-0634-6324-a318-eb35ed45ec2b@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox