From e38b4439269b3e480c9febc228b684910be03c1d Mon Sep 17 00:00:00 2001 From: Taiki Koshino Date: Fri, 21 Aug 2026 09:34:57 +0900 Subject: [PATCH v4] doc: Reformat SELECT queries using GRAPH_TABLE The SELECT queries using GRAPH_TABLE in ddl.sgml and queries.sgml were written on single long lines, requiring horizontal scrolling. Break the queries across multiple lines to improve readability. --- doc/src/sgml/ddl.sgml | 15 +++++++++++---- doc/src/sgml/queries.sgml | 13 +++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 160f4eebb35..80e45eaf27c 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -5824,12 +5824,15 @@ CREATE PROPERTY GRAPH myshop This graph could then be queried like this: -- get list of customers active today -SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers)-[IS customer_orders]->(o IS orders WHERE o.ordered_when = current_date) COLUMNS (c.name AS customer_name)); +SELECT customer_name FROM GRAPH_TABLE (myshop + MATCH (c IS customers)-[IS customer_orders]->(o IS orders WHERE o.ordered_when = current_date) + COLUMNS (c.name AS customer_name)); corresponding approximately to this relational query: -- get list of customers active today -SELECT customers.name FROM customers JOIN customer_orders USING (customer_id) JOIN orders USING (order_id) WHERE orders.ordered_when = current_date; +SELECT customers.name FROM customers JOIN customer_orders USING (customer_id) JOIN orders USING (order_id) + WHERE orders.ordered_when = current_date; @@ -5888,7 +5891,9 @@ CREATE PROPERTY GRAPH myshop With this definition, we can write a query like this: -SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customer)-[IS has_placed]->(o IS "order" WHERE o.ordered_when = current_date) COLUMNS (c.name AS customer_name)); +SELECT customer_name FROM GRAPH_TABLE (myshop + MATCH (c IS customer)-[IS has_placed]->(o IS "order" WHERE o.ordered_when = current_date) + COLUMNS (c.name AS customer_name)); With the new labels the MATCH clause is now more intuitive. @@ -5927,7 +5932,9 @@ CREATE PROPERTY GRAPH myshop employees table to something, but it is allowed like this.) Then we can run a query like this (incomplete): -SELECT ... FROM GRAPH_TABLE (myshop MATCH (IS person WHERE name = '...')-[]->... COLUMNS (...)); +SELECT ... FROM GRAPH_TABLE (myshop + MATCH (IS person WHERE name = '...')-[]->... + COLUMNS (...)); This would automatically consider both the customers and the employees tables when looking for an edge with the diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml index 3d729f983b5..393055ced51 100644 --- a/doc/src/sgml/queries.sgml +++ b/doc/src/sgml/queries.sgml @@ -2768,7 +2768,9 @@ SELECT * FROM t; Consider this example from : -- get list of customers active today -SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers)-[IS customer_orders]->(o IS orders WHERE o.ordered_when = current_date) COLUMNS (c.name AS customer_name)); +SELECT customer_name FROM GRAPH_TABLE (myshop + MATCH (c IS customers)-[IS customer_orders]->(o IS orders WHERE o.ordered_when = current_date) + COLUMNS (c.name AS customer_name)); The graph query part happens inside the GRAPH_TABLE construct. As far as the rest of the query is concerned, this acts like a @@ -2777,7 +2779,9 @@ SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers)-[IS custome names can be assigned to the result, and the result can be joined with other tables, subsequently filtered, and so on, for example: -SELECT ... FROM GRAPH_TABLE (mygraph MATCH ... COLUMNS (...)) AS myresult (a, b, c) JOIN othertable USING (a) WHERE b > 0 ORDER BY c; +SELECT ... FROM GRAPH_TABLE (mygraph + MATCH ... + COLUMNS (...)) AS myresult (a, b, c) JOIN othertable USING (a) WHERE b > 0 ORDER BY c; @@ -2893,8 +2897,9 @@ SELECT ... FROM GRAPH_TABLE (mygraph MATCH ... COLUMNS (...)) AS myresult (a, b, For example (assuming appropriate definitions of the property graph as well as the underlying tables): -GRAPH_TABLE (mygraph MATCH (p IS person)-[h IS has]->(a IS account) - COLUMNS (p.name AS person_name, h.since AS has_account_since, a.num AS account_number) +GRAPH_TABLE (mygraph + MATCH (p IS person)-[h IS has]->(a IS account) + COLUMNS (p.name AS person_name, h.since AS has_account_since, a.num AS account_number) WHERE clauses can be used inside element patterns to filter matches: -- 2.52.0