From: Koshino Taiki <koshino@sraoss.co.jp>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: doc: Reformat SELECT queries using GRAPH_TABLE
Date: Fri, 28 Aug 2026 05:09:38 +0000
Message-ID: <OS9P286MB6486BEACED1E79E3EB8B5F4594AC2@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CAHGQGwHP4voXA5DU82hjqUTZarwSmsFeKG7FXSW+zCqaYgNCLA@mail.gmail.com>
References: <OS9P286MB64860BD6CD6D4B4B0E1CEDE894A32@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM>
<CAExHW5uAtipTuUhZk7g5uaJQc4+X50_YptiAzfr4nOsmDDifaA@mail.gmail.com>
<OS9P286MB64861F8B663553D3E18F368494AF2@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM>
<CAHGQGwFxcf7+189ii8PqaD4KP_CW+UA7w92oWWL4eKK6T5OKnw@mail.gmail.com>
<OS9P286MB64867F881B1AA850A8F174F794AE2@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM>
<CAHGQGwHP4voXA5DU82hjqUTZarwSmsFeKG7FXSW+zCqaYgNCLA@mail.gmail.com>
> I think v3 is preferable. The corresponding relational query in
> ddl.sgml is also long, but it isn't a GRAPH_TABLE example, so I think
> we should keep this patch focused on reformatting GRAPH_TABLE examples.
Thanks, I agree v3's scope is the right one to go with,
so I'll keep this patch focused on the GRAPH_TABLE examples and
leave the JOIN query and other cases out of scope here.
> Regarding v3 patch, this example in queries.sgml seems to be missing
> the closing parenthesis for GRAPH_TABLE. That is, I think ")" should be
> added at the end of the example above.
I've added the missing closing parenthesis and attached a v5 patch.
Regards,
Taiki Koshino
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
________________________________
On Wed, Aug 26, 2026 at 10:25 AM Koshino Taiki <koshino@sraoss.co.jp> wrote:
> I wasn't sure whether this should be part of the same patch,
> so I've attached two versions: v3 leaves it untouched,
> and v4 includes the change. Let me know which you'd prefer.
I think v3 is preferable. The corresponding relational query in
ddl.sgml is also long, but it isn't a GRAPH_TABLE example, so I think
we should keep this patch focused on reformatting GRAPH_TABLE examples.
If necessary, you could start a separate thread about reformatting long
query examples in the documentation. It might be better to review all
such examples and reformat them consistently, rather than addressing
only the long query in ddl.sgml mentioned here.
-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)
Regarding v3 patch, this example in queries.sgml seems to be missing
the closing parenthesis for GRAPH_TABLE. That is, I think ")" should be
added at the end of the example above.
BTW, it would be helpful if you could trim the quoted text in your replies,
leaving only the parts relevant to your response. There's no need to
include the entire previous email at the bottom.
Regards,
--
Fujii Masao
Attachments:v5-0001-doc-Reformat-SELECT-queries-using-GRAPH_TABLE.patch (application/octet-stream, 4.6K) download
From 9d0d6002c391d47f315b91da577e30ac2ce1ddfc Mon Sep 17 00:00:00 2001
From: Taiki Koshino <koshio@sraoss.co.jp>
Date: Thu, 20 Aug 2026 09:15:24 +0900
Subject: [PATCH v5] 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 | 12 +++++++++---
doc/src/sgml/queries.sgml | 13 +++++++++----
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgmlindex 160f4eebb35..d57e1a4b9b3 100644--- a/doc/src/sgml/ddl.sgml+++ b/doc/src/sgml/ddl.sgml@@ -5824,7 +5824,9 @@ CREATE PROPERTY GRAPH myshop
This graph could then be queried like this:
<programlisting>
-- 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));
</programlisting>
corresponding approximately to this relational query:
<programlisting>
@@ -5888,7 +5890,9 @@ CREATE PROPERTY GRAPH myshop
<para>
With this definition, we can write a query like this:
<programlisting>
-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));
</programlisting>
With the new labels the <literal>MATCH</literal> clause is now more intuitive.
</para>
@@ -5927,7 +5931,9 @@ CREATE PROPERTY GRAPH myshop
<literal>employees</literal> table to something, but it is allowed like
this.) Then we can run a query like this (incomplete):
<programlisting>
-SELECT ... FROM GRAPH_TABLE (myshop MATCH (IS person WHERE name = '...')-[]->... COLUMNS (...));+SELECT ... FROM GRAPH_TABLE (myshop+ MATCH (IS person WHERE name = '...')-[]->...+ COLUMNS (...));
</programlisting>
This would automatically consider both the <literal>customers</literal> and
the <literal>employees</literal> tables when looking for an edge with the
diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgmlindex 3d729f983b5..bd1497ff80d 100644--- a/doc/src/sgml/queries.sgml+++ b/doc/src/sgml/queries.sgml@@ -2768,7 +2768,9 @@ SELECT * FROM t;
Consider this example from <xref linkend="ddl-property-graphs"/>:
<programlisting>
-- 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));
</programlisting>
The graph query part happens inside the <literal>GRAPH_TABLE</literal>
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:
<programlisting>
-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;
</programlisting>
</para>
@@ -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):
<programlisting>
-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))
</programlisting>
<literal>WHERE</literal> clauses can be used inside element patterns to
filter matches:
--
2.52.0
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: koshino@sraoss.co.jp, masao.fujii@gmail.com, ashutosh.bapat.oss@gmail.com
Subject: Re: doc: Reformat SELECT queries using GRAPH_TABLE
In-Reply-To: <OS9P286MB6486BEACED1E79E3EB8B5F4594AC2@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM>
References: <OS9P286MB64860BD6CD6D4B4B0E1CEDE894A32@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM> <CAExHW5uAtipTuUhZk7g5uaJQc4+X50_YptiAzfr4nOsmDDifaA@mail.gmail.com> <OS9P286MB64861F8B663553D3E18F368494AF2@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM> <CAHGQGwFxcf7+189ii8PqaD4KP_CW+UA7w92oWWL4eKK6T5OKnw@mail.gmail.com> <OS9P286MB64867F881B1AA850A8F174F794AE2@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM> <CAHGQGwHP4voXA5DU82hjqUTZarwSmsFeKG7FXSW+zCqaYgNCLA@mail.gmail.com> <OS9P286MB6486BEACED1E79E3EB8B5F4594AC2@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox