Re: Proposal for psql wildcarding behavior w/schemas - Mailing list pgsql-hackers

From Greg Sabino Mullane
Subject Re: Proposal for psql wildcarding behavior w/schemas
Date
Msg-id E17dIRW-0003UH-00@granger.mail.mindspring.net
Whole thread Raw
In response to Proposal for psql wildcarding behavior w/schemas  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Proposal for psql wildcarding behavior w/schemas  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Here's my thoughts on the matter:

More than one period throws an error (something pleasant, mentioning 
that we do not quite support cross-database queries yet).

I'll assume we are switching to the "explicit wildcard" system for this. 
(I think the proposed *? wildcards are a great idea). Basically, for 
those functions (esp. \d) that can return a list or a single item, 
the wildcard indicates that we want a list, and a lack of wildcard 
indicates we want a single item.

\d foo.baz    Shows details about the table bar in the schema foo

\d baz        Attempts to find a visible baz in the schemas, shows first              one that matches.

\d baz*       Shows all tables starting with "baz", in all available schemas

\d *.baz*     Same as above

\d baz.*      Shows all tables in the baz schema

\d foo.baz*   Shows all tables starting with "baz" in the "foo" schema

\d *.baz      Similar to \d baz, but the wildcard forces all matches              to be shown.

\d foo*.baz   Shows all tables named "baz" in schemas staring with "foo"

\d *.*        Same as plain old \d (which is actually a special case now)

\d *oo.       Matches all tables in schemas ending in "oo"

\d *oo.*      Same as above - a plain * on either side of the dot is             usually superfluous, except that it
forcesa list of matches.
 


The only one I have a problem with is the '\d baz' which some may argue should 
continue the current behavior and return details about the first "baz" 
table it encounters. On the other hand, people really need to start thinking 
about schemas and the consequences of having more than one table named 
"baz". Still, typing in the schema could get tedious very quickly. Perhaps it 
should only return a list if more than one table was found, otherwise it 
will return information about that table.

The good thing about the above is that \d and \dt will actually have the 
same functionality. The current behavior can be a bit confusing, in that 
some functions have implicit wildcards (\dt and friends) and some do 
not (\d).

Greg Sabino Mullane  greg@turnstep.com
PGP Key: 0x14964AC8 200208091849

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE9VEb6vJuQZxSWSsgRAsHNAKDCXz4vUY1A79EaVmfPIfcNS7VyxgCaA5Tx
HrNmY0vITbb2G1fZFBCPgBM=
=qhYp
-----END PGP SIGNATURE-----




pgsql-hackers by date:

Previous
From: Yuva Chandolu
Date:
Subject: Problem with lower() function
Next
From: Joe Conway
Date:
Subject: Re: Wanted: RelationIsVisible interface