Re: Proposal for psql wildcarding behavior w/schemas

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal for psql wildcarding behavior w/schemas
Date: 2002-08-09 22:50:10
Message-ID: E17dIRW-0003UH-00@granger.mail.mindspring.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 forces a 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(at)turnstep(dot)com
PGP Key: 0x14964AC8 200208091849

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

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-08-09 22:53:03 Re: Proposal: stand-alone composite types
Previous Message Joe Conway 2002-08-09 22:41:33 Re: Wanted: RelationIsVisible interface