Re: Wrong query result w/ propgraph single lateral col reference

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Noah Misch <noah(at)leadboat(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Wrong query result w/ propgraph single lateral col reference
Date: 2026-07-16 11:29:38
Message-ID: CAExHW5t31eeMDeVSr8JkQaqRM9fK50ub2BN0-EKs21Uvtvmoog@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 8, 2026 at 6:59 PM Ashutosh Bapat
<ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>
> On Wed, Jul 8, 2026 at 2:35 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
> >
> > I would like this code to be organized differently. Note that the
> > existing insert_*_record functions don't do any error checking; they are
> > just there to make catalog modifications. There are various check_*
> > functions that pretty much correspond to syntax rule checks, but these
> > are run after the catalog changes, hence the present issue. Maybe we
> > should have a set of "pre-check" functions in addition?
> >

If we consolidate all the pre-checks together similar to post checks,
we duplicate the catalog lookups. But a future code may miss calling
pre-checks before calling insert_*_record(). I tried to write one
precheck function for insert_label_record and insert_property_record
respectively and ended up calling it close to the insert_*_record
itself. The effort is attached as
v20260716-0001-pre-check-Report-duplicate-property-and-label-names-.patch.nocibot
I don't like the result.

>
> Do you expect insert_element_record() to perform sanity checks of
> labels or insert_label_record() to perform sanity checks on
> properties? Or do you expect a hierarchy of pre_check_ functions
> cascading from elements to labels to properties?

If I understand your intention to keep functions inserting records
into catalogs simple, Attached
v20260716-0001-simple-insert-Report-duplicate-property-and-label-names.patch.nocibot
is what I could come up with. It adds one insert_*_record() function
for every property graph catalog, and then an add_* functions which
call the insert_*_record functions after necessary pre-checks. I like
this version better. It doesn't collect all the checks like check_*
functions but create a hierarchy of checks and catalog inserts keeping
the latter simple. I have also rearranged the code so that all the
catalog insert functions are together and their wrappers are together
respectively.

--
Best Wishes,
Ashutosh Bapat

Attachment Content-Type Size
v20260716-0001-pre-check-Report-duplicate-property-and-label-names-.patch.nocibot application/octet-stream 12.1 KB
v20260716-0001-simple-insert-Report-duplicate-property-and-label-names-.patch text/x-patch 32.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2026-07-16 11:32:11 Re: ri_Fast* crash w/ nullable UNIQUE constraint
Previous Message Tatsuo Ishii 2026-07-16 11:13:10 Re: Fix duplicate detection for null-treatment window functions