Re: pg_get_INDEXdef - opclass

Lists: pgsql-hackers
From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_get_INDEXdef - opclass
Date: 2006-06-12 11:13:45
Message-ID: E7F85A1B5FF8D44C8A1AF6885BC9A0E401388881@ratbert.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bah, I mean pg_get_indexdef of course :-)

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Dave Page
> Sent: 12 June 2006 12:12
> To: pgsql-hackers(at)postgresql(dot)org
> Subject: [HACKERS] pg_get_viewdef - opclass
>
> Following a pgAdmin bug report, I noticed that pg_get_viewdef doesn't
> return the opclass when called for a specific column (in 8.1
> at least) -
> for example, for the index:
>
> CREATE UNIQUE INDEX bar_pattern_idx2 ON foofoo USING btree
> (lower((bar)::text) bpchar_pattern_ops, bar2)
>
> A query on column 1 returns:
>
> lower((bar)::text)
>
> It seems to me that the opclass should be included as well.
>
> Regards, Dave.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org
> so that your
> message can get through to the mailing list cleanly
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_get_INDEXdef - opclass
Date: 2006-06-12 17:32:15
Message-ID: 10789.1150133535@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Dave Page" <dpage(at)vale-housing(dot)co(dot)uk> writes:
>> Following a pgAdmin bug report, I noticed that pg_get_viewdef doesn't
>> return the opclass when called for a specific column (in 8.1
>> at least) -

> Bah, I mean pg_get_indexdef of course :-)

This is intentional --- whoever asked for the per-column variant of
the indexdef function wanted it that way. It seems reasonable to me:
you can extract the opclass name with a simple join against
pg_index.indclass[N], when you need it, whereas if the function
sometimes included an opclass name that would tend to break apps that
weren't expecting it. OTOH, getting the expression for an expression
column would be seriously painful if there were no function to do it.

regards, tom lane