Re: Separate psql commands from arguments

From: Decibel! <decibel(at)decibel(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Gregory Stark <stark(at)enterprisedb(dot)com>, "Brendan Jurd" <direvus(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bernd Helmle" <mailings(at)oopsware(dot)de>
Subject: Re: Separate psql commands from arguments
Date: 2008-04-10 20:51:03
Message-ID: 6FFA4636-E6DD-4F85-A772-2DEEC2AB77A0@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Am Samstag, 5. April 2008 schrieb Gregory Stark:
> On Apr 10, 2008, at 7:50 AM, Peter Eisentraut wrote:
>> I also don't see any point in allowing aliases which call other psql
>> commands.

Why disallow it? I think it could be very useful. One thing I
sometimes find myself doing is wanting to run a command on a list of
tables. That can be accomplished via:

SELECT 'ALTER TABLE ' || oid::regclass || 'blah;' FROM pg_class
WHERE ...
\g | psql blah blah blah

I'd love to be able to alias something like that.

Another real example is being able to force certain output functions
for certain queries. In particular, it would be handy if I had an
alias that was SELECT now()-query_start,* FROM pg_stat_activity WHERE
current_query != '<IDLE>' ORDER BY 1 and force that to be brought
into less (which I could probably do via \g | less).
--
Decibel!, aka Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Decibel! 2008-04-10 21:14:33 Re: Commit fest queue
Previous Message Hannu Krosing 2008-04-10 20:04:45 Re: Free Space Map data structure