Re: psql \d option list overloaded - Mailing list pgsql-hackers
From | Alex J. Avriette |
---|---|
Subject | Re: psql \d option list overloaded |
Date | |
Msg-id | 20040105154534.GF8524@posixnap.net Whole thread Raw |
In response to | psql \d option list overloaded (Bruce Momjian <pgman@candle.pha.pa.us>) |
Responses |
Re: psql \d option list overloaded
Re: psql \d option list overloaded |
List | pgsql-hackers |
On Sun, Jan 04, 2004 at 07:59:02PM -0600, D. Dante Lorenso wrote: > Anything other than simple, short commands is a waste, IMHO. I can easily > remember SHOW DATABASES and SHOW TABLES and DESC <table>, because they > reflect > my intensions directly and 'make sense'. What makes sense to me in csh doesn't make sense in a bourne shell. You can't expect all applications to work correctly. I'd like to second Peter's "yep" when asked if he could remember all the various \d* commands. It really comes down to whether you're trying. New software (even though you may have been using it for a year) requires some adjustment. > Using the slash commands works if you are familiar with them ... sorta > like 'ls' switches (I type 'ls -alF' without thinking about what those > switches do because it's embedded in my head from years of repetition. > Any other flags to 'ls', and I gotta go hit the man pages.) So, hit the documentation when you can't find what you need. Postgres has superb documentation. Or, as a counterpoint, ls -alF doesn't always work on every operating system (such as old IRIX and old SunOS), and is sometimes even a shell builtin. The flawed assumption, again, is that because /your/ environment supports something, that another environment should. > What's more important is the ability to use these commands from any > interface not just 'psql' client. I think 'psql' already has the slash > commands. No need to create NEW slash commands there... > > >If you want to find out how to show the databases in sql, use psql -E. > > > > > Have you actually done that? OMG! Yes, I do it frequently. You may notice a recent post of mine used exactly that output. > 1) Using System Catalogs ... (from psql -E) > > SELECT n.nspname as "Schema", > c.relname as "Name", > CASE c.relkind -snip- > ORDER BY 1,2; If the point here was to show that it was a complex query, then the only real reply is "This is why we have macros!". > 3) like MySQL does it... > > SHOW TABLES; Should postgres also support the '#' comment? What other non-sql sqlisms should we support? > There's something to be said about the 'SHOW'and 'DESC' sql-extensions > added into MySQL. Newbies can really 'get' it quickly. It's what really I would argue that these are not "sql extensions" at all. If you like, I can go over the source to verify this myself, but my guess is that MySQL is doing exactly what postgres is doing, and evaluating this as a macro. Furthermore, databases are not designed for "newbies" to jump right in with both feet. They are designed to be robust and stable. Additionally, some SQL compliance is nice. After that, you work on features. Changing the interface so that you or others don't have to read the documentation smacks of laziness. Somebody like Bruce, Peter, or Tom (or indeed somebody else) is going to waste yet more time making things like this available to somebody who probably won't read any of the other documentation either, and will wind up on irc pestering somebody like myself, Dave, or Neil. Why is this progress? > sold me on MySQL when I first learned it. For me, it's like: > > 'dir' in DOS, > 'ls' in Unix > 'SHOW' in MySQL > ??? in PostgreSQL ? We've been over this. It's \d*. > Sure, with time as my database needs grew and I matured as a developer, > I eventually gained more respect for PostgreSQL and have made the switch > even without this feature, but to this day, I really think MySQL *did it > right* with those extensions. You can't become a PostgreSQL guru without > being a newbie first. I vote we make it easier for newbies. What really frightens me here is that I know of several applications (shudder, "LAMP" applications) which use the output of "show tables" or other of your "extensions." The problem with this is precisely that it /isn't/ sql, and it can't be supported as a static command. It is intended to be there for people to use interactively. Making "pseudo sql" will encourage more developers to (and I'd apologize for this if it weren't true) code in Postgres the same lazy way they code in MySQL. Alex -- alex@posixnap.net Alex J. Avriette, Unix Systems Engineer "It's computationally FEROCIOUS." - Steve Jobs, discussing 64-bit computing
pgsql-hackers by date: