Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
[ j/n next | k/p prev | g top | r reply | u up ]- From: Saqib
Newsgroups: comp.databases.postgresql
Subject: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
Date: Mon, 30 Mar 2026 19:17:21 +0000 #
Message-ID: <7b7801a2d2db857ffb6a4af0780b0030@quettabyte.net>
X-User-Agent: Quettabyte/1.0 (Terminal Edition)Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL in version 19: https://www.postgresql.org/docs/devel/sql-create-property-graph.html CREATE [ TEMP | TEMPORARY ] PROPERTY GRAPH name [ {VERTEX|NODE} TABLES ( vertex_table_definition [, ...] ) ] [ {EDGE|RELATIONSHIP} TABLES ( edge_table_definition [, ...] ) ] where vertex_table_definition is: vertex_table_name [ AS alias ] [ KEY ( column_name [, ...] ) ] [ element_table_label_and_properties ] and edge_table_definition is: edge_table_name [ AS alias ] [ KEY ( column_name [, ...] ) ] SOURCE [ KEY ( column_name [, ...] ) REFERENCES ] source_table [ ( column_name [, ...] ) ] DESTINATION [ KEY ( column_name [, ...] ) REFERENCES ] dest_table [ ( column_name [, ...] ) ] [ element_table_label_and_properties ] and element_table_label_and_properties is either: NO PROPERTIES | PROPERTIES ALL COLUMNS | PROPERTIES ( { expression [ AS property_name ] } [, ...] ) or: { { LABEL label_name | DEFAULT LABEL } [ NO PROPERTIES | PROPERTIES ALL COLUMNS | PROPERTIES ( { expression [ AS property_name ] } [, ...] ) ] } [...]- |-- ReplyFrom: Saqib
Newsgroups: comp.databases.postgresql
Subject: Re: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
Date: Wed, 01 Apr 2026 02:17:54 +0000 #
Message-ID: <47abab66ecf9dcc125e647bacc998eb9@quettabyte.net>
X-User-Agent: Quettabyte/1.0 (Terminal Edition)Defining Property Graphs in PostgreSQL 19: https://www.postgresql.org/docs/devel/ddl-property-graphs.html Relations Table definition: CREATE TABLE products ( product_no integer PRIMARY KEY, name varchar, price numeric ); CREATE TABLE customers ( customer_id integer PRIMARY KEY, name varchar, address varchar ); CREATE TABLE orders ( order_id integer PRIMARY KEY, ordered_when date ); CREATE TABLE order_items ( order_items_id integer PRIMARY KEY, order_id integer REFERENCES orders (order_id), product_no integer REFERENCES products (product_no), quantity integer ); CREATE TABLE customer_orders ( customer_orders_id integer PRIMARY KEY, customer_id integer REFERENCES customers (customer_id), order_id integer REFERENCES orders (order_id) ); Property Graph definition: CREATE PROPERTY GRAPH myshop VERTEX TABLES ( products, customers, orders ) EDGE TABLES ( order_items SOURCE orders DESTINATION products, customer_orders SOURCE customers DESTINATION orders ); get a list of customers who placed an order today using the ASCII Art based Pattern Matching ((node)->[edge]->(node)) 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));- |-- ReplyFrom: Saqib
Newsgroups: comp.databases.postgresql
Subject: Re: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
Date: Wed, 01 Apr 2026 03:22:41 +0000 #
Message-ID: <df81c730cb531919142ef00d2ade153a@quettabyte.net>
X-User-Agent: Quettabyte/1.0 (Terminal Edition)PostgreSQL 19 includes implementation of SQL property graph queries, according to SQL/PGQ standard (ISO/IEC 9075-16:2023). This adds: - GRAPH_TABLE table function for graph pattern matching - DDL commands CREATE/ALTER/DROP PROPERTY GRAPH- |-- ReplyFrom: Saqib
Newsgroups: comp.databases.postgresql
Subject: Re: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
Date: Sun, 05 Apr 2026 14:13:08 +0000 #
Message-ID: <0dfd97366a5881331f8cfb3c0f0f5af7@quettabyte.net>
X-User-Agent: Quettabyte/1.0 (Terminal Edition)Traditionally, solutions to graph-like problems- such as reachability and shortest-path discovery- have relied on SQL Recursive Common Table Expressions (CTEs), which are often verbose, difficult to optimize, and complex to maintain. The SQL:2023 standard introduces SQL/PGQ (Property Graph Queries), finally allowing relational databases to treat graph traversals as first-class, declarative operations. Support for SQL/PGQ is coming to PostgreSQL 19.- |-- ReplyFrom: Scott
Newsgroups: comp.databases.postgresql
Subject: Re: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
Date: Sun, 26 Apr 2026 19:37:33 +0000 #
Message-ID: <1511312afad3a5abc397a17e3384a7a7@quettabyte.net>
X-User-Agent: Quettabyte/1.0 (Terminal Edition)It looks like version 19 will have native graph SQL Property Graph Queries (SQL/PGQ). It's the part of the SQL:2023 ISO standard and provides the ability to efficiently represent and query graph data. That means we will have the ability to use declarative language to declare graph operations (from definitions, traversals, shortest paths, etc) without having to resort to those convoluted recursive CTEs.
- |-- ReplyFrom: Eleni
Newsgroups: comp.databases.postgresql
Subject: Re: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
Date: Sat, 02 May 2026 13:16:32 +0000 #
Message-ID: <3b96e703a3535a3371259457f01c8253@quettabyte.net>
X-User-Agent: Quettabyte/1.0 (Terminal Edition)A friend-of-friend example: -- Define a graph over existing tables CREATE PROPERTY GRAPH social_network VERTEX TABLES (users LABEL person PROPERTIES (id, name)) EDGE TABLES ( related_to SOURCE KEY (person_a) REFERENCES users (id) DESTINATION KEY (person_b) REFERENCES users (id) LABEL friend ); -- Query: find friends of friends SELECT * FROM GRAPH_TABLE (social_network MATCH (a IS person WHERE a.name = 'Eleni') -[IS friend]->(b IS person) -[IS friend]->(c IS person) COLUMNS (b.name AS friend, c.name AS friend_of_friend) ); - |-- ReplyFrom: Uroosa
Newsgroups: comp.databases.postgresql
Subject: Re: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
Date: Sun, 03 May 2026 15:11:14 +0000 #
Message-ID: <70991d30928891fa7e637319b6b24499@quettabyte.net>
X-User-Agent: Quettabyte/1.0 (Terminal Edition)Here is an example of how to use SQL/PGQ to analyze email communication data. While this is a simple example, it shows the power of Graph Queries: CREATE TABLE users ( id integer NOT NULL, person_name varchar ); CREATE TABLE email ( id integer NOT NULL, sender integer, recipient integer, subject text ); -- user - sent -> user CREATE PROPERTY GRAPH communication_graph VERTEX TABLES ( users AS email_user KEY (id) PROPERTIES (id, person_name) ) EDGE TABLES ( email AS sent KEY (id) SOURCE KEY (sender) REFERENCES email_user (id) DESTINATION KEY (recipient) REFERENCES email_user (id) ) ; INSERT INTO users VALUES (1, 'Uroosa'); INSERT INTO users VALUES (2, 'Fatima'); INSERT INTO users VALUES (3, 'Hannah'); INSERT INTO email VALUES (1, 1, 2, 'vacation plan'); -- From Uroosa to Fatima INSERT INTO email VALUES (2, 2, 1, 'vacation plan'); -- From Fatima to Uroosa INSERT INTO email VALUES (3, 1, 3, 'transportation inquiry'); -- From Uroosa to Hannah -- Who did Uroosa received emails from SELECT * FROM GRAPH_TABLE(communication_graph MATCH (a IS email_user WHERE a.person_name = 'Uroosa') <-[IS sent]- (b IS email_user) COLUMNS (b.person_name) ); -- output Fatima (1 row) -- Who did Uroosa emailed? SELECT * FROM GRAPH_TABLE(communication_graph MATCH (a IS email_user WHERE a.person_name = 'Uroosa') -[IS sent]-> (b IS email_user) COLUMNS (b.person_name) ); -- output Fatima Hannah (2 rows)