psql \d option list overloaded

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: "D. Dante Lorenso" <dante@lorenso.com>
Cc: PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Date: 2004-01-04T01:25:21Z
Lists: pgsql-hackers
D. Dante Lorenso wrote:
> > When I started with PostgreSQL and MySQL, MySQL was far easier
> > to use
> 
> I started with MySQL and it WAS easier to use.  It was easier because
> the manual essentially reads:
> 
>    -- we didn't implement anything complicated that's why
>    -- we are fast.
> 
> The only SQL customizations that MySQL has that I really miss in PostgreSQL
> are the commands:
> 
> 	SHOW DATABASES;
> 	SHOW TABLES;
> 	DESC table;
> 
> That was ubber simple to do in MySQL.  To this day, I have trouble with
> that in PostgreSQL.  I'm constantly doing:
> 
> 	psql> \?
> 	psql> help;
> 	ERROR:  syntax error at or near "help" at character 1
> 	psql> \h
> 	...
> 	* damnit, that's not it...*
> 	psql> \?
> 	psql> \d
> 	* ok, now which flag do I use for tables vs functions..etc?*
> 
> I finally figure it out, I just end up forgetting again later.  I still
> have no clue how I'd find the same data without using psql.  In MySQL
> I can run those queries from PHP, PERL...etc.  I know you can find that
> data in system tables in PostgreSQL, but I don't wanna muck around with
> all that.  I just wanna do something as simple as MySQL.

[ Moved to hackers.]

I am starting to agree that our \d* handling is just too overloaded. 
Look at the option list from \?:
	
	Informational
	  \d [NAME]      describe table, index, sequence, or view
	  \d{t|i|s|v|S} [PATTERN] (add "+" for more detail)
	                 list tables/indexes/sequences/views/system tables
	  \da [PATTERN]  list aggregate functions
	  \dc [PATTERN]  list conversions
	  \dC            list casts
	  \dd [PATTERN]  show comment for object
	  \dD [PATTERN]  list domains
	  \df [PATTERN]  list functions (add "+" for more detail)
	  \dg [PATTERN]  list groups
	  \dn [PATTERN]  list schemas
	  \do [NAME]     list operators
	  \dl            list large objects, same as \lo_list
	  \dp [PATTERN]  list table access privileges
	  \dT [PATTERN]  list data types (add "+" for more detail)
	  \du [PATTERN]  list users
	  \l             list all databases (add "+" for more detail)
	  \z [PATTERN]   list table access privileges (same as \dp)

Can anyone remember all those?  With the single-letter options, once the
list got too long, we started encouraging long option names.  It seems
the same is true of \d.

I like the idea of adding a new syntax to show that information using
simple SQL command syntax, and putting it in the backend so all
applications can access it.  I know we have information schema, and
maybe that can be used to make this simpler.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073