From e093dcdd2853911ca1ad710581182dfcb6c78ea3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 25 Aug 2006 04:06:58 +0000 Subject: Add the ability to create indexes 'concurrently', that is, without blocking concurrent writes to the table. Greg Stark, with a little help from Tom Lane. --- src/backend/optimizer/util/plancat.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/backend/optimizer/util') diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 47e39c6a788..5e3c7d98575 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.124 2006/08/05 00:22:49 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.125 2006/08/25 04:06:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -138,6 +138,18 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, RelOptInfo *rel) indexRelation = index_open(indexoid, lmode); index = indexRelation->rd_index; + /* + * Ignore invalid indexes, since they can't safely be used for + * queries. Note that this is OK because the data structure + * we are constructing is only used by the planner --- the + * executor still needs to insert into "invalid" indexes! + */ + if (!index->indisvalid) + { + index_close(indexRelation, NoLock); + continue; + } + info = makeNode(IndexOptInfo); info->indexoid = index->indexrelid; -- cgit v1.2.3