psql \d option list overloaded

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: psql \d option list overloaded
Date: 2004-01-04 01:25:21
Message-ID: 200401040125.i041PLR14687@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-general 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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Keith C. Perry 2004-01-04 01:58:09 Re: Is my MySQL Gaining ?
Previous Message Rory Campbell-Lange 2004-01-03 23:18:39 Re: Is my MySQL Gaining ?

Browse pgsql-general by date

  From Date Subject
Next Message Chris Ochs 2004-01-04 01:57:26 replication choices
Previous Message Bruce Momjian 2004-01-04 01:07:21 Re: license issue

Browse pgsql-hackers by date

  From Date Subject
Next Message Keith C. Perry 2004-01-04 01:58:09 Re: Is my MySQL Gaining ?
Previous Message Andrew Dunstan 2004-01-04 01:18:43 Re: Restrict users from describing table