Re: Separate psql commands from arguments

Поиск
Список
Период
Сортировка
От Decibel!
Тема Re: Separate psql commands from arguments
Дата
Msg-id 6FFA4636-E6DD-4F85-A772-2DEEC2AB77A0@decibel.org
обсуждение исходный текст
Ответ на Re: Separate psql commands from arguments  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Separate psql commands from arguments  (Gregory Stark <stark@enterprisedb.com>)
Список 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@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Fabiana Prabhakar"
Дата:
Сообщение:
Следующее
От: Decibel!
Дата:
Сообщение: Re: Commit fest queue