Re: Allow to collect statistics on virtual generated columns

Yugo Nagata <nagata@sraoss.co.jp>

From: Yugo Nagata <nagata@sraoss.co.jp>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org
Date: 2026-03-26T17:39:00Z
Lists: pgsql-hackers

Attachments

On Thu, 26 Mar 2026 17:25:23 +0000
Dean Rasheed <dean.a.rasheed@gmail.com> wrote:

> On Thu, 26 Mar 2026 at 16:00, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
> >
> > On Thu, 26 Mar 2026 at 15:09, Yugo Nagata <nagata@sraoss.co.jp> wrote:
> > >
> > > I've attached an updated patch including the documentation and tests.
> 
> Looking at get_relation_statistics(), I think that you need to call
> expand_generated_columns_in_expr() *before* ChangeVarNodes() so that
> Vars in the expanded expression end up with the correct varno.

Thank you for the review.

I've corrected the placement of expand_generated_columns_in_expr()
so that it is called before ChangeVarNodes(). A revised patch is attached.

Regards,
Yugo Nagata

-- 
Yugo Nagata <nagata@sraoss.co.jp>

Commits

  1. Add support for extended statistics on virtual generated columns.