cwida / duckpgq-extension

DuckDB extension that adds support for SQL/PGQ
https://duckpgq.notion.site/b8ac652667964f958bfada1c3e53f1bb?v=3b47a8d44bdf4e0c8b503bf23f1b76f2
MIT License
86 stars 7 forks source link

Unbounded query with no path mode or path prefix is not allowed #49

Closed Dtenwolde closed 9 months ago

Dtenwolde commented 1 year ago

The following query is not allowed:

-FROM GRAPH_TABLE (snb
    MATCH (a:Person WHERE a.id = 17592186044461)-[k:knows]-> *(b:Person where b.id = 35184372088856)
    COLUMNS (a.id as a_id, b.id as b_id)
    ) tmp LIMIT 20

This query should be interpreted as an ALL path query, which would lead to infinite results if you follow the standard. A path prefix like ANY or ANY-k or a path mode such as TRAIL, ACYCLIC, or SIMPLE should be used to avoid infinite results.

In the current implementation, this is allowed. It could perhaps be detected in the transformer that we have an unbounded path query with an implied ALL path prefix and then an error should be thrown that ALL path is not implemented

Dtenwolde commented 9 months ago

Fixed, now throws an error if there is no MATCH <path_variable> = ANY (SHORTEST) <path_pattern> before it