Skip site navigation (1) Skip section navigation (2)

psql command aliases support

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: pgsql-patches(at)postgresql(dot)org
Subject: psql command aliases support
Date: 2008-04-01 14:36:34
Message-ID: 81006C66CD7D9C5007325FD1@imhotep.credativ.de (view raw or flat)
Thread:
Lists: pgsql-patches
Folks,

please find attached a patch which implements psql command aliases. They 
work the same way as on bash, zsh and others, for example:

#= \alias d \dt+
#= \d
              List of relations
 Schema | Name | Type  | Owner | Description
--------+------+-------+-------+-------------
 public | foo  | table | bernd |
(1 row)

=# \alias current_query SELECT current_query, NOW() - query_start FROM 
pg_stat_activity WHERE current_query NOT LIKE 'IDLE%';

#= \current_query
                                             current_query 
| ?column?
-------------------------------------------------------------------------------------------------------+----------
 SELECT current_query, NOW() - query_start FROM pg_stat_activity WHERE 
current_query NOT LIKE 'IDLE%'; | 00:00:00
(1 row)


#= \unalias d
#= \d
       List of relations
 Schema | Name | Type  | Owner
--------+------+-------+-------
 public | foo  | table | bernd
(1 row)


I hope i broke nothing and maybe we find this useful for 8.4, documentation 
included.

-- 
  Thanks

                    Bernd

Attachment: psql_aliases.patch
Description: text/x-diff (12.2 KB)

Responses

pgsql-patches by date

Next:From: Mathias HasselmannDate: 2008-04-01 15:07:31
Subject: Re: [HACKERS] Avahi support for Postgresql
Previous:From: Albe LaurenzDate: 2008-04-01 13:34:17
Subject: Improve shutdown during online backup

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group