Re: Show method of index - Mailing list pgsql-hackers

From David Fetter
Subject Re: Show method of index
Date
Msg-id 20090509180225.GV18067@fetter.org
Whole thread Raw
In response to Re: Show method of index  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Show method of index
List pgsql-hackers
On Fri, May 08, 2009 at 04:43:44PM -0400, Alvaro Herrera wrote:
> Ricardo Bessa escribió:
> > Hi,
> > 
> >     I think that can be useful the command \di on psql show the method of
> > index (hash, btree, ...) like:
> > 
> >     test=# \di
> >                            List of relations
> >      Schema |     Name      | Type  |   Owner    | Table  | Method
> >     --------+---------------+-------+------------+--------+--------
> >      public | test_id_idx   | index | postgresql | table1 | btree
> >      public | test_name_idx | index | postgresql | table1 | hash
> >     (2 rows)
> 
> Well, you can see that with \d on the table, but IMHO this should be
> present on \di too, so +1.
> 
> One gripe I had with \d and indexes the other day is that it sucks
> on functional indexes -- it just says "pg_expression_1".

So after a little wrong-tree-up-barking, I grepped the source tree for
pg_expression, and it turns out that the fault lies not in psql, but
in src/backend/catalog/index.c's ConstructTupleDescriptor, which
automatically names the with this, um, somewhat uninformative name.  I
see this comment just above the offending code:
           /*            * Make the attribute's name "pg_expresssion_nnn" (maybe            * think of            *
somethingbetter later)            */
 

Any ideas for a better naming convention?

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: abdelhak benmohamed
Date:
Subject: postgres and postmaster
Next
From: Tom Lane
Date:
Subject: Re: Show method of index