Обсуждение: Allow virtual columns in index expressions or predicate

Поиск
Список
Период
Сортировка

Allow virtual columns in index expressions or predicate

От
Richard Guo
Дата:
I'm looking for a solution to support virtual generated columns in
index expressions or predicate.  The comment in DefineIndex() seems to
suggest that virtual generated columns there can be expanded in
RelationGetIndexExpressions() and RelationGetIndexPredicate().

   /*
    * XXX Virtual generated columns in index expressions or predicates
    * could be supported, but it needs support in
    * RelationGetIndexExpressions() and RelationGetIndexPredicate().
    */

I'm not sure this is the appropriate approach, especially since we
don't have the heap relation available in these functions.  I think
we're good as long as we expand the virtual columns before the index
build process; otherwise, evaluating these expressions during the
build will cause executor errors due to unexpanded virtual columns.

I wonder if we can do the expansion in DefineIndex(), before the call
to index_create(), like the attached.

- Richard

Вложения