Andreas Pflug <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> The best way is to use pg_get_indexdef(indexOID), same as pg_dump and
>> psql do.

> [ doesn't want to parse the pg_get_indexdef output... ]

Well, I guess if you just want one column it's kind of a pain.

> pg_get_indexdef converts that string to a list of nodes (not 
> surprising), while pg_get_expr whill join these list elements with an 
> explicit and (according to a comment, needed for partial index). Do I 
> need to retrieve indexprs and split it myself (counting brackets) or is 
> there a pg_xxx function that could help me (pg_get_element(indexprs, 
> 0...n)) ?

There isn't any real good way to do it, and I'd discourage you from
writing client-side code that roots around in those fields anyway.
It's much too likely to break in future versions.

Does anyone else think it's reasonable to define a backend function
along the lines of pg_get_indexdef(indexoid, columnnumber) that
retrieves just the column-name-or-expression for the indicated column
of the index?  I'm not eager to do it if just one person wants it,
but if there's more than one potential user...

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to