Re: Confusing behavior of psql's \e

From: Jacob Champion <pchampion(at)vmware(dot)com>
To: "laurenz(dot)albe(at)cybertec(dot)at" <laurenz(dot)albe(at)cybertec(dot)at>
Cc: "chap(at)anastigmatix(dot)net" <chap(at)anastigmatix(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Confusing behavior of psql's \e
Date: 2021-03-04 16:51:55
Message-ID: 3f3ce8d021c53a9205ecf3f2d1f67f2d044338fa.camel@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2021-03-04 at 17:41 +0100, Laurenz Albe wrote:
> So if you do your "modify and save the file in less than a second"
> trick with the old code, you would end up with the old, unmodified
> data in the query buffer.

Sorry, I was unclear in my first post -- I'm not modifying the
temporary file. Just saving and quitting with :wq, which is much easier
to do in less than a second.

> I would say that the old behavior is worse in that case, and
> discarding the query buffer is better.

For the case where you've modified the buffer, I agree, and I'm not
arguing otherwise.

> I am not against fixing or improving the behavior, but given the
> fact that we can't portably get less than second precision, it
> seems impossible.

You could backdate the temporary file, so that any save is guaranteed
to move the timestamp forward. That should work even if the filesystem
has extremely poor precision.

--Jacob

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-03-04 16:53:42 Re: [PATCH] regexp_positions ( string text, pattern text, flags text ) → setof int4range[]
Previous Message David Steele 2021-03-04 16:48:48 Re: [PATCH] postgres-fdw: column option to override foreign types