| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
| Cc: | assam258(at)gmail(dot)com, Junwang Zhao <zhjwpku(at)gmail(dot)com>, zengman <zengman(at)halodbtech(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Ajay Pal <ajay(dot)pal(dot)k(at)gmail(dot)com>, Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: SQL Property Graph Queries (SQL/PGQ) |
| Date: | 2026-03-27 09:58:47 |
| Message-ID: | bb7caddd-4feb-4233-83f6-2ea07e9030f3@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 26.03.26 08:08, Ashutosh Bapat wrote:
> Consider following query
> Query1
> SELECT x1.a, g.* FROM x1, GRAPH_TABLE (myshop MATCH (x1 IS
> customers)-[IS customer_orders]->(o IS orders WHERE o.order_id = x1.a)
> COLUMNS (x1.name AS customer_name, x1.customer_id AS cid)) g;
>
> x1 is a table referenced in from clause as well as an element pattern
> variable in path pattern. If we don't allow backward (cross)
> referencing, x1.a in the element pattern o resolves to the table x1's
> column a, but x1.name resolves to element x1's property reference
> name. So within the same graph pattern x1 may get resolved to two
> different things, even though x1 was declared before using it. Is that
> how we expect it to happen? Let's call this inconsistency1.
I don't think this interpretation is correct.
Even if we don't support non-local element variable references, we still
need to *recognize* them. We just don't need to be able to process
them, we can error out if we see them.
> 0001: is a small adjustment to make sure that we add an element
> variable name to the graph table namespace only once. This isn't a
> problem right now, but we will have to do that anyway in [1] and it
> has some effect one 0002.
committed
> 0002: prohibits cross element variable references within graph_table
> clause. It adds a new member GraphTableParseState::cur_variable to
> track the variable name of the current pattern being transformed. We
> can not use llast() simply because a. pattern currently being
> transformed may not have name, so llast will be misleading b. changes
> in 0001. We may want to combine 0001 and 0002 when committing.
(under discussion)
> 0003: prohibits consecutive element patterns of the same kind
committed (I made the error message wording a bit more compact.)
> 0004: some cleanup remaining from
> 5282bf535e474dc2517f2e835d147420ae2144de. We may want to wait to
> accumulate more cleanups.
I don't think this patch goes into the right direction. The existing
code seems preferable.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-03-27 10:07:40 | Re: Enable -Wstrict-prototypes and -Wold-style-definition by default |
| Previous Message | Chao Li | 2026-03-27 09:51:57 | Bug: wrong relname in RemoveSubscriptionRel() error detail |