Search Postgresql Archives

Re: defining yuor own commands in PG ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Dec 19, 2009, at 2:59 AM, Filip Rembiałkowski wrote:


2009/12/18 Gauthier, Dave <dave.gauthier@xxxxxxxxx>

Can you define your own commands in PG. 

In psql, yes:

\set sel 'SELECT * FROM'
:sel clients;

\set desc '\\d'
:desc table

 

E.g., if users from other DBs use “describe foo” to get the metadata for foo, is there a way I can create a command “describe” to = “\d” ?


But what's wrong with "\d"? For me, its like the first thing people learn when practicing postgres.
It is even faster to type than DESCRIBE, right?

Just to put in my 2¢, I write a program that can use a MySQL, PostgreSQL, or SQLite database as its backend, depending on user preference. As a result, I spend time in all three databases each day. It can get a bit confusing at times trying to remember "ok, in this terminal window I need to do a 'describe foo', in that one I need to do a '\d foo' and in the third '.schema foo'". So being able to simplify that at least somewhat is nice :) That said, I'd be just as happy getting MySQL to recognize the \d command as I would be getting postgres to recognize describe-perhaps more so.


IMO, when you will bend postgres to mimick other DBMS, you will hide its real power from users.



--
Filip Rembiałkowski
JID,mailto:filip.rembialkowski@xxxxxxxxx
http://filip.rembialkowski.net/

-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------

BEGIN:VCARD
VERSION:3.0
N:Brewster;Israel;;;
FN:Israel Brewster
ORG:Frontier Flying Service;MIS
TITLE:PC Support Tech II
EMAIL;type=INTERNET;type=WORK;type=pref:israel@xxxxxxxxxxxxxxxxxx
TEL;type=WORK;type=pref:907-450-7293
item1.ADR;type=WORK;type=pref:;;5245 Airport Industrial Wy;Fairbanks;AK;99701;
item1.X-ABADR:us
CATEGORIES:General
X-ABUID:36305438-95EA-4410-91AB-45D16CABCDDC\:ABPerson
END:VCARD


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux