Re: Review: query result history in psql

From: ian link <ian(at)ilink(dot)io>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Maciej Gajewski <maciej(dot)gajewski0(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: query result history in psql
Date: 2013-06-28 06:11:19
Message-ID: CAOOwM5++hTguczTfz+w5g1B6P49scV0Vc=tqRx4x-mRT9iP-3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> It's better to post a review as a reply to the message which contains
> the patch.

Sorry about that, I did not have the email in my inbox and couldn't figure
out how to use the old message ID to send a reply. Here is the thread:
http://www.postgresql.org/message-id/flat/CAEcSYXJRi++T3pevDyzAWH2yGx7kG9ZrhX8KAWtP1fXV3H02vw(at)mail(dot)gmail(dot)com#CAEcSYXJRi++T3pevDyzAWH2yGx7kG9ZrhX8KAWtP1fXV3H02vw@mail.gmail.com

The 'EscapeForCopy' was meant to mean 'Escape string in a format require by
> the COPY TEXT format', so 'copy' in the name refers to the escaping format,
> not the action performed by the function.
>

I see, that makes sense now. Keep it as you see fit, it's not a big deal in
my opinion.

Some mathematical toolkits, like Matlab or Mathematica, automatically set
> a variable called 'ans' (short for "answer") containing the result of the
> last operation. I was trying to emulate exactly this behaviour.

I've actually been using Matlab lately, which must be why the name made
sense to me intuitively. I don't know if this is the best name, however. It
kind of assumes that our users use Matlab/Octave/Mathematica. Maybe 'qhist'
or 'hist' or something?

The history is not erased. The history is always stored in the client's
> memory.

Ah, I did not pick up on that. Thank you for explaining it! That's actually
a very neat way of doing it. Sorry I did not realize that at first.

I was considering such a behaviour. But since the feature is turned off by
> default, I decided that whoever is using it, is aware of cost. Instead of
> truncating the history automatically (which could lead to a nasty
> surprise), I decided to equip the user with \ansclean , a command erasing
> the history. I believe that it is better to let the user decide when
> history should be erased, instead of doing it automatically.

I think you are correct. However, if we turn on the feature by default (at
some point in the future) the discussion should probably be re-visited.

This is my first submitted patch, so I can't really comment on the
> process. But if you could add the author's email to CC, the message would
> be much easier to spot. I replied after two days only because I missed the
> message in the flood of other pgsql-hacker messages. I think I need to scan
> the list more carefully...

My fault, I definitely should have CC'd you.

As for the patch, I made a new version of the latest one you provided in
the original thread. Let me know if anything breaks, but it compiles fine
on my box. Thanks for the feedback!

Ian

Attachment Content-Type Size
query-history-review1.patch application/octet-stream 17.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-06-28 06:28:19 Re: Review: query result history in psql
Previous Message Pavel Stehule 2013-06-28 05:49:46 Re: proposal: enable new error fields in plpgsql (9.4)