Re: Showing index details with \d on psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Showing index details with \d on psql
Date: 2001-10-14 22:07:54
Message-ID: 2881.1003097274@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Hmm, shouldn't that be "foo_pkey(thread) (primary key)". I understand
> what you meant about the brackets, but brackets aren't typically used in
> writing and look artificial. Maybe something like

> foo_pkey (thread) -- primary key

Or

primary key: foo_pkey (thread)
unique: foo_serial_key (serialcol)

Note my advice nearby for Greg to make use of pg_get_indexdef, which
returns a CREATE INDEX command string for the index. I have an ulterior
motive here, which is that pg_get_indexdef will deliver useful
information about functional and partial indexes, and I think \d ought
to show that stuff.

In the case of a partial index, anything tacked onto the end of the line
is likely to be confused with the partial index condition. Consider
these examples, all obtained from the regression database with
select pg_get_indexdef(oid) from pg_class where relkind='i';

CREATE INDEX onek2_u2_prtl ON onek2 USING btree (unique2) WHERE (stringu1 < 'B'::name)
CREATE INDEX rect2ind ON fast_emp4000 USING rtree (home_base bigbox_ops)
CREATE UNIQUE INDEX func_index_index ON func_index_heap USING btree (textcat(f1, f2))

I suggest that \d should produce entries like this:

Indexes: onek2_u2_prtl btree (unique2) WHERE (stringu1 < 'B'::name)

Indexes: rect2ind rtree (home_base bigbox_ops)

Indexes: unique: func_index_index btree (textcat(f1, f2))

or possibly this would read better:

Indexes: func_index_index unique btree (textcat(f1, f2))

(s/unique/primary key/ where appropriate).

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-10-14 23:01:43 Re: psql: default base and password reading
Previous Message Tom Lane 2001-10-14 20:52:04 Re: psql: default base and password reading