On 27/11/2026 04:41, wenhui qiu wrote:

    1. Canonicalize parameterized TidScan quals in
    BuildParameterizedTidPaths() so that the scanned relation's ctid is
    always on the left (via commute_restrictinfo(rinfo, TIDEqualOperator),
    similar to what match_opclause_to_indexcol() does for index scans).
    That way, parameterized TidScans consistently produce "TID Cond:
    (ctid = t1.ctid)" regardless of which relation populated
    ec_derives_list first.

    Doing this only in BuildParameterizedTidPaths() leaves single-rel
    cases
    like "WHERE '(0,1)' = ctid" alone (preserving test coverage for the
    commuted OpExpr branch in nodeTidscan.c and avoiding breaking the
    OR-clause list_difference() check in create_tidscan_plan()), and only
    changes the two join plans in expected/tidscan.out.  Note that
    create_tidscan_plan() would also need to check rinfo_serial rather
    than
    list_member_ptr(tidquals, rinfo) when removing duplicate scan_clauses,
    otherwise a commuted non-EC join clause (such as the LEFT JOIN test in
    tidscan.sql) would be left behind as a redundant Filter.

    2. Alternatively, handle PGS_TIDSCAN via disabled_nodes in
    cost_tidscan() / cost_tidrangescan() instead of skipping path
    generation in create_tidscan_paths(), matching PGS_SEQSCAN,
    PGS_INDEXSCAN, and PGS_BITMAPSCAN.  That avoids changing tidscan.out,
    though as noted in pathnodes.h, skipping path generation was chosen to
    preserve the historical behavior of enable_tidscan = off (e.g., when
    enable_seqscan is also off).

    Between the two, (1) feels cleaner to me since it removes the
    EXPLAIN output's sensitivity to EC derivation order altogether,
    but I'd
    be interested to hear what others think.

Agree, option 1 seems fine.


Regards,
Ayoub Kazar

Reply via email to