Re: Wrong query result w/ propgraph single lateral col reference - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Wrong query result w/ propgraph single lateral col reference
Date
Msg-id CAExHW5t31eeMDeVSr8JkQaqRM9fK50ub2BN0-EKs21Uvtvmoog@mail.gmail.com
Whole thread
In response to Re: Wrong query result w/ propgraph single lateral col reference  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
List pgsql-hackers
On Wed, Jul 8, 2026 at 6:59 PM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
>
> On Wed, Jul 8, 2026 at 2:35 PM Peter Eisentraut <peter@eisentraut.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

pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Fix duplicate detection for null-treatment window functions
Next
From: Amit Langote
Date:
Subject: Re: ri_Fast* crash w/ nullable UNIQUE constraint