On Fri, Apr 5, 2024 at 8:35 PM Amit Langote <amitlangot...@gmail.com> wrote: > > On Thu, Apr 4, 2024 at 9:02 PM Amit Langote <amitlangot...@gmail.com> wrote: > > I'll post the rebased 0002 tomorrow after addressing your comments. > > Here's one. Main changes: > > * Fixed a bug in get_table_json_columns() which caused nested columns > to be deparsed incorrectly, something Jian reported upthread. > * Simplified the algorithm in JsonTablePlanNextRow() > > I'll post another revision or two maybe tomorrow, but posting what I > have now in case Jian wants to do more testing. >
+ else + { + /* + * Parent and thus the plan has no more rows. + */ + return false; + } in JsonTablePlanNextRow, the above comment seems strange to me. + /* + * Re-evaluate a nested plan's row pattern using the new parent row + * pattern, if present. + */ + Assert(parent != NULL); + if (!parent->current.isnull) + JsonTableResetRowPattern(planstate, parent->current.value); Is this assertion useful? if parent is null, then parent->current.isnull will cause segmentation fault. I tested with 3 NESTED PATH, it works! (I didn't fully understand JsonTablePlanNextRow though). the doc needs some polish work.