Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQL
- From: Saqib | Date: Mon, 30 Mar 2026 19:17:21 +0000 #
Subject: Support for Property Graph ISO/IEC 9075-16:2023 (SQL/PGQ) is coming to PostgreSQLSupport 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 ( vertextabledefinition [, ...] ) ] [ {EDGE|RELATIONSHIP} TABLES ( edgetabledefinition [, ...] ) ] where vertextabledefinition is: vertextablename [ AS alias ] [ KEY ( columnname [, ...] ) ] [ elementtablelabeland_properties ] and edgetabledefinition is: edgetablename [ AS alias ] [ KEY ( column_name [, ...] ) ] SOURCE [ KEY ( columnname [, ...] ) REFERENCES ] sourcetable [ ( column_name [, ...] ) ] DESTINATION [ KEY ( columnname [, ...] ) REFERENCES ] desttable [ ( column_name [, ...] ) ] [ elementtablelabelandproperties ] and elementtablelabelandproperties is either: NO PROPERTIES | PROPERTIES ALL COLUMNS | PROPERTIES ( { expression [ AS property_name ] } [, ...] ) or: { { LABEL labelname | DEFAULT LABEL } [ NO PROPERTIES | PROPERTIES ALL COLUMNS | PROPERTIES ( { expression [ AS propertyname ] } [, ...] ) ] } [...]- |-- ReplyFrom: Saqib | Date: Wed, 01 Apr 2026 02:17:54 +0000 #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 ( orderitemsid integer PRIMARY KEY, orderid integer REFERENCES orders (orderid), productno integer REFERENCES products (productno), quantity integer ); CREATE TABLE customer_orders ( customerordersid integer PRIMARY KEY, customerid integer REFERENCES customers (customerid), orderid integer REFERENCES orders (orderid) ); 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 customerorders]->(o IS orders WHERE o.orderedwhen = current_date) COLUMNS (c.name AS customer_name));
- |-- ReplyFrom: Saqib | Date: Wed, 01 Apr 2026 03:22:41 +0000 #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 | Date: Sun, 05 Apr 2026 14:13:08 +0000 #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 | Date: Sun, 26 Apr 2026 19:37:33 +0000 #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 | Date: Sat, 02 May 2026 13:16:32 +0000 #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 GRAPHTABLE (socialnetwork 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 friendoffriend) );
- |-- ReplyFrom: Uroosa | Date: Sun, 03 May 2026 15:11:14 +0000 #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 emailuser KEY (id) PROPERTIES (id, personname) ) 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 GRAPHTABLE(communicationgraph MATCH (a IS emailuser WHERE a.personname = 'Uroosa') <-[IS sent]- (b IS email_user) COLUMNS (b.person_name) ); -- output Fatima (1 row) -- Who did Uroosa emailed? SELECT * FROM GRAPHTABLE(communicationgraph MATCH (a IS emailuser WHERE a.personname = 'Uroosa') -[IS sent]-> (b IS email_user) COLUMNS (b.person_name) ); -- output Fatima Hannah (2 rows)
- |-- ReplyFrom: Saqib Ali | Date: Tue, 02 Jun 2026 18:53:07 +0000 #A nice blogpost by Christophe Pettus on Propery Graph support in Postgres 19: https://thebuild.com/blog/managed-postgres-examined-azure-database-for-postgresql-flexible-server/ Sample SQL from the blogpost: You declare the graph: CREATE PROPERTY GRAPH social_graph VERTEX TABLES ( people LABEL Person PROPERTIES (id, name, birth_year) ) EDGE TABLES ( friendships SOURCE KEY (person_a) REFERENCES people (id) DESTINATION KEY (person_b) REFERENCES people (id) LABEL Knows PROPERTIES (since) ); You query it: SELECT b_name FROM GRAPHTABLE (socialgraph MATCH (a:Person WHERE a.name = 'Jan')-[k:Knows]->(b:Person) COLUMNS (b.name AS b_name) );
Keyboard Shortcuts:
[ j/n next | k/p prev | g top | r reply | u up ]