diff options
Diffstat (limited to 'src/backend/catalog/index.c')
-rw-r--r-- | src/backend/catalog/index.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 93b7171963b..f4087fedd04 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -47,7 +47,6 @@ #include "miscadmin.h" #include "nodes/nodeFuncs.h" #include "optimizer/clauses.h" -#include "optimizer/var.h" #include "storage/bufmgr.h" #include "storage/lmgr.h" #include "storage/procarray.h" @@ -775,16 +774,12 @@ index_create(Oid heapRelationId, } /* - * It's possible for an index to not depend on any columns of the - * table at all, in which case we need to give it a dependency on - * the table as a whole; else it won't get dropped when the table - * is dropped. This edge case is not totally useless; for - * example, a unique index on a constant expression can serve to - * prevent a table from containing more than one row. + * If there are no simply-referenced columns, give the index an + * auto dependency on the whole table. In most cases, this will + * be redundant, but it might not be if the index expressions and + * predicate contain no Vars or only whole-row Vars. */ - if (!have_simple_col && - !contain_vars_of_level((Node *) indexInfo->ii_Expressions, 0) && - !contain_vars_of_level((Node *) indexInfo->ii_Predicate, 0)) + if (!have_simple_col) { referenced.classId = RelationRelationId; referenced.objectId = heapRelationId; |