From: | Tim Landscheidt <tim(at)tim-landscheidt(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using readline for frequently used queries |
Date: | 2010-03-29 00:03:24 |
Message-ID: | m3vdcg5703.fsf@passepartout.tim-landscheidt.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I wrote:
> depending on the database, I use some "dashboard queries"
> rather frequently. To ease executing them, I've put:
> | $include /etc/inputrc
> | $if psql
> | "\e[24~": "\fSELECT * FROM DashboardQuery;\n"
> | $endif
> in my ~/.inputrc ("\e[24~" is [F12]).
> Obviously, this only works if a) the current line and
> b) the query buffer are empty. Before I try and err: Has
> anyone put some thought in how to reliably do that? My first
> impulse would be C-a, C-k, "\r", C-j, but this doesn't solve
> the problem if psql is in "quote mode" (e. g. the previous
> line contained an opening "'" or '"').
I found that C-c (SIGINT) makes a clean sweep but it doesn't
work as a readline macro as it gets handled by psql. So I
opted for:
| "\e[24~": "\C-a\C-k\\r\n\fSELECT * FROM DashboardQuery;\n"
which works well enough except for "quote mode".
Tim
From | Date | Subject | |
---|---|---|---|
Next Message | Yar Tykhiy | 2010-03-29 00:20:06 | Re: warm standby possible with 8.1? |
Previous Message | Filip Rembiałkowski | 2010-03-28 23:37:20 | Re: optimizing import of large CSV file into partitioned table? |