Dave Page <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Hm, there is a definitional issue here. Should pg_get_indexdef print >> this stuff at all when colno is nonzero? >> ... >> Dave, I think we put in this variant of the function for pgAdmin --- >> what does pgAdmin need?
> More is better for us - it saves an ugly query that will get uglier if > we need to figure out ASC/DESC here too :-) > I agree that we should have all or nothing though, so I'd like to see > ASC/DESC and opclass please. I dug through the archives and found that we've had this discussion before ;-). The basic argument for having the per-column form of pg_get_indexdef do what it does was that it's unreasonable for client-side code to try to disassemble an expression tree string, whereas extracting opclass info is a relatively straightforward exercise in joining. There are several past threads about this: http://archives.postgresql.org/pgsql-hackers/2003-07/msg00083.php http://archives.postgresql.org/pgsql-general/2005-11/msg01106.php http://archives.postgresql.org/pgsql-hackers/2006-06/msg00576.php As of 8.3 that expands into also having to know the meaning of the bits in indoption[], which is kind of annoying, but not even close to being in the same league as reverse-compiling expressions. I think the current API expectation for pg_get_indexdef is that it produces only the index column/expression, and that we are very likely to break client-side code if we change that. I don't have any objection to providing an additional new API that includes the opclass and ASC/DESC decoration in the output ... other than that I think it's a bit too late for 8.3; adding a function would mean forcing initdb, and I don't see any reasonable way to shoehorn two behaviors into the existing function signature. Just out of curiosity, why is pgAdmin doing it this way at all? Seems it would be a lot easier to use the all-columns form of pg_get_indexdef than to cons up the display from fetches of each column individually. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings