Can you create aliases in the psql shell?

Started by Modulokabout 13 years ago3 messagesgeneral
Jump to latest
#1Modulok
modulok@gmail.com

List,

Is there a way to create command aliases in the psql shell? I can never
remember all the \d* commands and have to look them up every time. If I could
create things like \list_databases, \list_tables, \list_roles, etc, it would be
much easier for me to remember.

Is there a way to create such aliases? I'm using 9.2.3 if that matters. I
didn't see anything in the man page. If not is there another command line
client interface?

Cheers!
-Modulok-

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Modulok (#1)
Re: Can you create aliases in the psql shell?

Modulok <modulok@gmail.com> wrote:

Is there a way to create command aliases in the psql shell? I can never

remember all the \d* commands and have to look them up every time. If I
could
create things like \list_databases, \list_tables, \list_roles, etc,
it would be
much easier for me to remember.

Is there a way to create such aliases? I'm using 9.2.3 if that matters. I
didn't see anything in the man page. If not is there another command line
client interface?

\set list_databases '\\l'

Then you can type :list_databases to get the same effect as \l

-Kevin

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Modulok
modulok@gmail.com
In reply to: Kevin Grittner (#2)
Re: Can you create aliases in the psql shell?

Is there a way to create command aliases in the psql shell? I can never

remember all the \d* commands and have to look them up every time. If I
could
create things like \list_databases, \list_tables, \list_roles, etc,
it would be
much easier for me to remember.

Is there a way to create such aliases? I'm using 9.2.3 if that matters. I
didn't see anything in the man page. If not is there another command line
client interface?

\set list_databases '\\l'

Then you can type :list_databases to get the same effect as \l

-Kevin

Thank you. This is perfect!

-Modulok-

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general