Re: SQL Property Graph Queries (SQL/PGQ) - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: SQL Property Graph Queries (SQL/PGQ)
Date
Msg-id 72a23702-6d96-4103-a54b-057c2352e885@eisentraut.org
Whole thread Raw
In response to Re: SQL Property Graph Queries (SQL/PGQ)  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
List pgsql-hackers
On 25.03.26 10:12, Ashutosh Bapat wrote:
> On Wed, Mar 25, 2026 at 2:27 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>>
>> On 23.03.26 16:00, Ashutosh Bapat wrote:
>>> An empty pattern has no label expression which is equivalent to
>>> disjunction of all applicable labels. If we add an empty pattern in
>>> the rewrite phase, we will require its label expression to be resolved
>>> in the rewrite phase. Looking at the proposed changes for all
>>> properties reference [1], I am moving towards resolving the label
>>> expression in the transformation stage itself. So I think it's better
>>> to add the implicit vertex patterns during the transformation stage to
>>> be future proof. Rewriter should just then rewrite the patterns into
>>> joins and unions. Your point is correct that the implicit vertex
>>> should not be visible in view definition or deparsed query. For that I
>>> have added a flag implicit to GraphElementPattern.
>>> GraphElementPatterns with implicit = true are ignored by ruleutils.
>>> Implemented it that way in the attached patch.
>>>
>>> Vertex patterns without an edge pattern in between are not supported
>>> OTOH. Added an ereport for the same.
>>>
>>> I have also added a few tests. I didn't add queries with all the
>>> patterns you mentioned above. I tested a few by hand and all of them
>>> worked as expected. Can you please check?
>>
>> This functionality that you can leave off empty vertex patterns at the
>> beginning and end is part of the optional feature G047, which we don't
>> claim to support.  So we should reject these path patterns.
>>
> 
> Thanks for the clarification. What about the implicit empty vertex
> patterns in the middle of the path? Should we reject these path
> patterns also?
Yes, I think so.

The specification of feature G047 is:

"... in conforming SQL language, any <edge pattern> shall be immediately 
preceded and followed by a <vertex pattern>."

So if you write

() -[]-> -[]-> ()

then the first edge pattern is not followed immediately by a vertex 
pattern, and so it would be invalid without feature G047.





pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: [Patch] add new parameter to pg_replication_origin_session_setup
Next
From: John Naylor
Date:
Subject: Re: [PATCH] Precompute string lengths in PerformRadiusTransaction