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 d290c749-9ebb-46a2-845d-5842ce0da626@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 09.12.25 11:21, Ashutosh Bapat wrote:
>> It looks like undirected matching -[ ]- (without arrows) doesn't work
>> correctly.  It seems to just match in one direction.  I don't see any
>> tests.  Is this implemented?
>>
> -[]- is called full edge any direction
> <full edge any direction> ::=
> <minus left bracket> <element pattern filler> <right bracket minus>
> 
> ~[]~ is defined as full edge undirected
> <full edge undirected> ::=
> <tilde left bracket> <element pattern filler> <right bracket tilde>
> 
> The patch supports full edge any direction since [1] in response to
> Ajay Pal's report. Such a pattern matches edges in both the
> directions. There's also a test
> -- edges directed in both ways - to and from v2
> SELECT * FROM GRAPH_TABLE (g1 MATCH (v1 IS vl2)-[conn]-(v2) COLUMNS
> (v1.vname AS v1name, conn.ename AS cname, v2.vname AS v2name));
>   v1name | cname | v2name
> --------+-------+--------
>   v21    | e122  | v12
>   v22    | e121  | v11
>   v22    | e231  | v32
> (3 rows)
> 
> SELECT * FROM GRAPH_TABLE (g1 MATCH (v1 IS vl2)-(v2) COLUMNS (v1.vname
> AS v1name, v2.vname AS v2name));
>   v1name | v2name
> --------+--------
>   v21    | v12
>   v22    | v11
>   v22    | v32
> (3 rows)
> 
> it's matching edges to and from vertices in v2. For example e121 is an
> edge from v11 to v22 whereas e231 is an edge from v22 to v32.

Attached is a test case from an Oracle web site (the URL is in the 
file).  At the end there are three queries, one left, one right, one any 
direction.  The latter should result in the union of the first two, but 
it doesn't.
Attachment

pgsql-hackers by date:

Previous
From: Antonin Houska
Date:
Subject: Re: Adding REPACK [concurrently]
Next
From: Tom Lane
Date:
Subject: Re: Making jsonb_agg() faster