From: | greg(at)turnstep(dot)com |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | Improved index support for \d and \di in psql |
Date: | 2001-11-19 16:27:12 |
Message-ID: | 3BF8EC90.1345.A2D95A@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here is a better version that allows psql to view functional and
partial indexes. (btw, my previous problem regarding the
partial-index predicate was an extra comma in a select statement)
I've used pg_get_indexdef (in most cases) for the advanced index
information, and put it in the SQL rather than having C
try and parse the string apart.
I also looked in the documentation, but did not find any spots
that need changing. The only thing that seemd to mention
"\d" in docs is the release notes and
sgml/ref/psql-ref.sgml, which is very vague and has no examples
that need changing. Perhaps that example section should be
expanded a bit?
Here is what the psql output looks like after the patch:
(table with a normal, a functional, and a partial index)
template1=# \d foo
Table "foo"
Column | Type | Modifiers
- --------+-----------------------+-----------
foo | integer |
bar | integer |
baz | character varying(20) |
Indexes: abc btree (foo) WHERE (foo < 100),
funky btree (lower(baz)),
simple btree (foo)
(all indexes now list waht table they belong to)
template1=# \di
List of relations
Name | Type | Owner | Table
- --------+-------+----------+-------
abc | index | postgres | foo
four | index | postgres | ftest
funky | index | postgres | foo
one | index | postgres | ftest
simple | index | postgres | foo
three | index | postgres | ftest
two | index | postgres | ftest
(a partial index)
template1=# \d abc
Index "abc"
Column | Type
- --------+---------
foo | integer
btree for table "foo" WHERE (foo < 100)
(a functional index - much improved over just showing 'lower')
template1=# \d funky
Index "funky"
Column | Type
- --------------+------
(lower(baz)) | text
btree for table "foo"
Greg Sabino Mullane
greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200111191050
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html
iQA/AwUBO/kqr7ybkGcUlkrIEQKzZQCfe3Bmbx3/c2YTOgifxK242KvyvSsAoPZf
vmVJtwAaYA2S4P0fqCaQR2Zm
=ZBN+
-----END PGP SIGNATURE-----
Attachment | Content-Type | Size |
---|---|---|
indexdetail2.patch | application/octet-stream | 10.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2001-11-19 18:47:51 | Version checking when loading psql |
Previous Message | Weiping He | 2001-11-17 16:33:26 | the new patches for zh_CN NLS |