Allow virtual columns in index expressions or predicate - Mailing list pgsql-hackers

From Richard Guo
Subject Allow virtual columns in index expressions or predicate
Date
Msg-id CAMbWs4811nG3w_3sLxps+EAuUsffA_83ZQ-1acEH_jQeq117mg@mail.gmail.com
Whole thread Raw
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Fixing MSVC's inability to detect elog(ERROR) does not return
Next
From: Stefanie Janine Stölting
Date:
Subject: Re: Problem with DEB packages