Thread

Commits

  1. Fix broken MemoizePath support in reparameterize_path().

  1. Is this an oversight in reparameterizing Memoize path?

    Richard Guo <guofenglinux@gmail.com> — 2022-12-02T14:29:47Z

    When reviewing other patch I noticed there might be an oversight for
    MemoizePath in reparameterize_path.  In reparameterize_path we are
    supposed to increase the path's parameterization to required_outer.
    However, AFAICS for MemoizePath we just re-create the same path thus its
    parameterization does not get increased.
    
    I'm not sure if this has consequences in practice.  Just from reading
    the codes, it seems this may cause assertion failure after the call of
    reparameterize_path.
    
        Assert(bms_equal(PATH_REQ_OUTER(path), required_outer));
    
    Thanks
    Richard
    
  2. Re: Is this an oversight in reparameterizing Memoize path?

    Tom Lane <tgl@sss.pgh.pa.us> — 2022-12-02T15:13:30Z

    Richard Guo <guofenglinux@gmail.com> writes:
    > When reviewing other patch I noticed there might be an oversight for
    > MemoizePath in reparameterize_path.  In reparameterize_path we are
    > supposed to increase the path's parameterization to required_outer.
    > However, AFAICS for MemoizePath we just re-create the same path thus its
    > parameterization does not get increased.
    
    Yeah, that sure looks wrong.  At minimum we should be recursively
    fixing the subpath.  (It looks like doing that and re-calling
    create_memoize_path might be sufficient.)
    
    According to [1] our code coverage for reparameterize_path is just
    awful.  MemoizePath in reparameterize_pathlist_by_child isn't
    tested either ...
    
    			regards, tom lane
    
    [1] https://coverage.postgresql.org/src/backend/optimizer/util/pathnode.c.gcov.html