Pavan Deolasee <pavan.deola...@gmail.com> writes: > On Tue, Nov 27, 2012 at 9:01 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> Either state of indcheckxmin is valid with all three of these >> combinations, so the specific kluge I was contemplating above doesn't >> work. But there is no valid reason for an index to be in this state: >> indisvalid = true, indisready = false
> Yeah, this looks much better, given our inability to add a new catalog > column in 9.2. Can we cheat a little though and use a value other than 0 > and 1 for indisvalid or indisready to tell the server to interpret it > differently ? No, not unless you'd like "select * from pg_index" to misbehave. Personally, I like being able to look at catalogs. > Andres complained about the fact that many callers of RelationGetIndexList > are probably not ready to process invalid or not-yet-ready indexes and > suggested that those changes should be backpatched to even older releases. > But IMO we should do that with a test case that demonstrates that there is > indeed a bug. Also, we should teach RelationGetIndexList to take a flags > argument and filter out indexes that the caller is not interested instead > of every caller doing the checks separately. We can't really change the API of RelationGetIndexList in the back branches, as it's just about certain there is third-party code calling it. I'm dubious about the advantages of such prefiltering anyway, as: (1) That would mean that every change to indisvalid/indisready would require forcing a relcache flush on the parent table. (Either that or RelationGetIndexList does pg_index lookups internally, which would mostly defeat the point of caching the index list at all.) (2) The big picture here is that it's silly to optimize for any case other than fully valid indexes, because anything else can be expected to be a low-probability transient state. So generally we might as well have RelationGetIndexList return all the indexes and let callers filter any that happen to be inappropriate for their usage. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers