Using readline for frequently used queries

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Using readline for frequently used queries
Date: 2010-03-26 14:35:23
Message-ID: m37hozywus.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

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 '"').

TIA,
Tim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Szymon Guz 2010-03-26 14:35:30 Re: Need help on updating an entire column with a list of values, I have.
Previous Message Alan McKay 2010-03-26 14:32:53 Solid State Drives with PG (was: in RAM DB)