From 2d8e9aca165edc6fb487043d07cbda9d3c307c99 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: Wed, 26 Aug 2026 12:36:25 +0530
Subject: [PATCH v20260827 1/2] pg_dump: Transfer dependencies of properties to
 property graph

getDependencies() transferred depencies of pg_propgraph_element entries
to the parent property graph but missed doing so for
pg_propgraph_property and pg_propgraph_label_property. Fix this
omission. One of the symptoms of this omission is seen as a failure to
restore a property graph which has a property with a table's row type as
its data type.  Table's row type depends upon the table which has the
same dump priority as the property graph. Without an appropriate
dependency transfer, the property graph may get dumped before the table.

We may avoid any dependency transfers if we handle all the property
graph components as dumpable objects and dump them separately using
ALTER PROPERTY GRAPH commands. But that will slow down the dump and
restore process.

Add a regression test to verify the dependency properties on user data
types (in the form of table row types). 002_pg_upgrade, which upgrades a
regression database, verifies the resulting dump order.

Notes to reviewers:

The test modifies an existing property graph by giving two of its labels
a property which involves table types. Previously, these labels used
default properties, but those are now covered by other tests in this
file or in graph_table.sql. So these changes do not affect the test
coverage or any tests downstream.

Adding a user-defined type widens the user_defined_type_schema column in
the output of the information_schema.pg_property_data_types query.  This
results in a large expected-output diff.  It is unavoidable because
user-defined types reside in a user-created schema.  That schema has a
relatively long name in this test.  We may eventually want to make such
output less sensitive to changes in column width.

Reported-by: Andres Freund <andres@anarazel.de>
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: TBD
Discussion: https://postgr.es/m/dqa5mstx5mna3i7s23pdwl4m6bek7gqsgfccef44wjpswizufi@3aa6vzri3cat
Backpatch-through: 19
---
 src/bin/pg_dump/pg_dump.c                     |  41 +++++-
 .../expected/create_property_graph.out        | 134 ++++++++++--------
 .../regress/sql/create_property_graph.sql     |  20 ++-
 3 files changed, 131 insertions(+), 64 deletions(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index db14834e430..8191e3521df 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -20260,15 +20260,50 @@ getDependencies(Archive *fout)
 						 "AND NOT (refclassid = 'pg_opfamily'::regclass AND amprocfamily = refobjid)\n");
 
 	/*
-	 * Translate dependencies of pg_propgraph_element entries into
-	 * dependencies of their parent pg_class entry.
+	 * Translate dependencies of components of a property graph into
+	 * dependencies of their parent (property graph) pg_class entry. These
+	 * components are stored in pg_propgraph_element, pg_propgraph_label,
+	 * pg_propgraph_property and pg_propgraph_element_label,
+	 * pg_propgraph_label_property. Out of these pg_propgraph_label and
+	 * pg_propgraph_element_label entries do not have dependencies outside the
+	 * property graph, so we don't need to translate those.
 	 */
 	if (fout->remoteVersion >= 190000)
+	{
+		/*
+		 * Eliminate dependencies of edges on vertexes since we will dump a
+		 * single CREATE PROPERTY GRAPH statement containing all the elements
+		 * together.
+		 */
 		appendPQExpBufferStr(query, "UNION ALL\n"
 							 "SELECT 'pg_class'::regclass AS classid, pgepgid AS objid, refclassid, refobjid, deptype "
 							 "FROM pg_depend d, pg_propgraph_element pge "
 							 "WHERE deptype NOT IN ('p', 'e', 'i') AND "
-							 "classid = 'pg_propgraph_element'::regclass AND objid = pge.oid\n");
+							 "classid = 'pg_propgraph_element'::regclass AND objid = pge.oid "
+							 "AND NOT (refclassid = 'pg_class'::regclass AND pgepgid = refobjid) "
+							 "AND refclassid <> 'pg_propgraph_element'::regclass\n");
+
+		appendPQExpBufferStr(query, "UNION ALL\n"
+							 "SELECT 'pg_class'::regclass AS classid, pgppgid AS objid, refclassid, refobjid, deptype "
+							 "FROM pg_depend d, pg_propgraph_property pgp "
+							 "WHERE deptype NOT IN ('p', 'e', 'i') AND "
+							 "classid = 'pg_propgraph_property'::regclass AND objid = pgp.oid "
+							 "AND NOT (refclassid = 'pg_class'::regclass AND pgppgid = refobjid)\n");
+
+		/*
+		 * Eliminate dependencies of pg_propgraph_label_properties on
+		 * pg_propgraph_element_label and pg_propgraph_property since they are
+		 * internal to the property graph which will be dumped as a single
+		 * DDL.
+		 */
+		appendPQExpBufferStr(query, "UNION ALL\n"
+							 "SELECT 'pg_class'::regclass AS classid, pgp.pgppgid AS objid, refclassid, refobjid, deptype "
+							 "FROM pg_depend d, pg_propgraph_label_property pglp, pg_propgraph_property pgp "
+							 "WHERE deptype NOT IN ('p', 'e', 'i') AND "
+							 "classid = 'pg_propgraph_label_property'::regclass AND objid = pglp.oid AND pglp.plppropid = pgp.oid "
+							 "AND NOT (refclassid IN ('pg_propgraph_element_label'::regclass, 'pg_propgraph_property'::regclass))\n");
+	}
+
 
 	/* Sort the output for efficiency below */
 	appendPQExpBufferStr(query, "ORDER BY 1,2");
diff --git a/src/test/regress/expected/create_property_graph.out b/src/test/regress/expected/create_property_graph.out
index 5bbd6477ed6..45288f99723 100644
--- a/src/test/regress/expected/create_property_graph.out
+++ b/src/test/regress/expected/create_property_graph.out
@@ -15,8 +15,21 @@ CREATE TABLE t3 (x int, y text, z text);
 -- INCLUDE column must not become part of the inferred element key
 CREATE TABLE e1 (a int, i int, t text, PRIMARY KEY (a, i) INCLUDE (t));
 CREATE TABLE e2 (a int, x int, t text);
+-- The table types used to test graph properties with user-defined
+-- datatypes.  Unlike other user defined types these types depend upon tables
+-- which have same dump priority as the property graph.  002_pg_upgrade will use
+-- this property graph to test dependency ordering in pg_dump.
+CREATE TABLE t_udt1 (a int, b int);
+CREATE TABLE t_udt2 (a int, b int);
 CREATE PROPERTY GRAPH g2
-    VERTEX TABLES (t1 KEY (a), t2 DEFAULT LABEL, t3 KEY (x) LABEL t3l1 LABEL t3l2)
+    VERTEX TABLES (
+        t1 KEY (a),
+        t2 DEFAULT LABEL,
+        t3 KEY (x)
+                   -- property with user-defined type
+                   LABEL t3l1 PROPERTIES ((row(x, 1)::t_udt1) AS p1)
+                   -- property with user-defined type inside expression
+                   LABEL t3l2 PROPERTIES ((row(x, 1)::t_udt2).a AS p2))
     EDGE TABLES (
         e1
             SOURCE KEY (a) REFERENCES t1 (a)
@@ -42,7 +55,15 @@ DETAIL:  vertex t1 of property graph g2 depends on column a of table t1
 edge e1 of property graph g2 depends on column a of table t1
 edge e2 of property graph g2 depends on column a of table t1
 HINT:  Use DROP ... CASCADE to drop the dependent objects too.
--- like g2 but assembled with ALTER
+DROP TABLE t_udt1;  -- fail
+ERROR:  cannot drop table t_udt1 because other objects depend on it
+DETAIL:  property p1 of property graph g2 depends on type t_udt1
+HINT:  Use DROP ... CASCADE to drop the dependent objects too.
+DROP TABLE t_udt2;  -- fail
+ERROR:  cannot drop table t_udt2 because other objects depend on it
+DETAIL:  property p2 of label t3l2 of vertex t3 of property graph g2 depends on table t_udt2
+HINT:  Use DROP ... CASCADE to drop the dependent objects too.
+-- property graph assembled using ALTER
 CREATE PROPERTY GRAPH g3;
 ALTER PROPERTY GRAPH g3 ADD VERTEX TABLES (t1 KEY (a), t2 DEFAULT LABEL);
 ALTER PROPERTY GRAPH g3
@@ -506,9 +527,8 @@ SELECT * FROM information_schema.pg_element_table_properties ORDER BY property_g
  regression             | create_property_graph_tests | g2                  | t2                  | i             | i
  regression             | create_property_graph_tests | g2                  | t2                  | j             | j
  regression             | create_property_graph_tests | g2                  | t2                  | k             | k
- regression             | create_property_graph_tests | g2                  | t3                  | x             | x
- regression             | create_property_graph_tests | g2                  | t3                  | y             | y
- regression             | create_property_graph_tests | g2                  | t3                  | z             | z
+ regression             | create_property_graph_tests | g2                  | t3                  | p1            | ROW(x, 1)::t_udt1
+ regression             | create_property_graph_tests | g2                  | t3                  | p2            | (ROW(x, 1)::t_udt2).a
  regression             | create_property_graph_tests | g3                  | t1                  | a             | a
  regression             | create_property_graph_tests | g3                  | t1                  | b             | b
  regression             | create_property_graph_tests | g3                  | t3                  | x             | x
@@ -552,7 +572,7 @@ SELECT * FROM information_schema.pg_element_table_properties ORDER BY property_g
  regression             | create_property_graph_tests | gt                  | v1                  | b             | b
  regression             | create_property_graph_tests | gt                  | v2                  | m             | m
  regression             | create_property_graph_tests | gt                  | v2                  | n             | n
-(57 rows)
+(56 rows)
 
 SELECT * FROM information_schema.pg_label_properties ORDER BY property_graph_name, label_name, property_name;
  property_graph_catalog |    property_graph_schema    | property_graph_name | label_name | property_name 
@@ -568,12 +588,8 @@ SELECT * FROM information_schema.pg_label_properties ORDER BY property_graph_nam
  regression             | create_property_graph_tests | g2                  | t2         | i
  regression             | create_property_graph_tests | g2                  | t2         | j
  regression             | create_property_graph_tests | g2                  | t2         | k
- regression             | create_property_graph_tests | g2                  | t3l1       | x
- regression             | create_property_graph_tests | g2                  | t3l1       | y
- regression             | create_property_graph_tests | g2                  | t3l1       | z
- regression             | create_property_graph_tests | g2                  | t3l2       | x
- regression             | create_property_graph_tests | g2                  | t3l2       | y
- regression             | create_property_graph_tests | g2                  | t3l2       | z
+ regression             | create_property_graph_tests | g2                  | t3l1       | p1
+ regression             | create_property_graph_tests | g2                  | t3l2       | p2
  regression             | create_property_graph_tests | g3                  | t1         | a
  regression             | create_property_graph_tests | g3                  | t1         | b
  regression             | create_property_graph_tests | g3                  | t3l1       | x
@@ -620,7 +636,7 @@ SELECT * FROM information_schema.pg_label_properties ORDER BY property_graph_nam
  regression             | create_property_graph_tests | gt                  | v1         | b
  regression             | create_property_graph_tests | gt                  | v2         | m
  regression             | create_property_graph_tests | gt                  | v2         | n
-(63 rows)
+(59 rows)
 
 SELECT * FROM information_schema.pg_labels ORDER BY property_graph_name, label_name;
  property_graph_catalog |    property_graph_schema    | property_graph_name | label_name 
@@ -654,50 +670,50 @@ SELECT * FROM information_schema.pg_labels ORDER BY property_graph_name, label_n
 (26 rows)
 
 SELECT * FROM information_schema.pg_property_data_types ORDER BY property_graph_name, property_name;
- property_graph_catalog |    property_graph_schema    | property_graph_name | property_name |     data_type     | character_maximum_length | character_octet_length | character_set_catalog | character_set_schema | character_set_name | collation_catalog | collation_schema | collation_name | numeric_precision | numeric_precision_radix | numeric_scale | datetime_precision | interval_type | interval_precision | user_defined_type_catalog | user_defined_type_schema | user_defined_type_name | scope_catalog | scope_schema | scope_name | maximum_cardinality | dtd_identifier 
-------------------------+-----------------------------+---------------------+---------------+-------------------+--------------------------+------------------------+-----------------------+----------------------+--------------------+-------------------+------------------+----------------+-------------------+-------------------------+---------------+--------------------+---------------+--------------------+---------------------------+--------------------------+------------------------+---------------+--------------+------------+---------------------+----------------
- regression             | create_property_graph_tests | g2                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | a
- regression             | create_property_graph_tests | g2                  | b             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | b
- regression             | create_property_graph_tests | g2                  | i             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | i
- regression             | create_property_graph_tests | g2                  | j             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | j
- regression             | create_property_graph_tests | g2                  | k             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | k
- regression             | create_property_graph_tests | g2                  | t             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | t
- regression             | create_property_graph_tests | g2                  | x             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | x
- regression             | create_property_graph_tests | g2                  | y             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | y
- regression             | create_property_graph_tests | g2                  | z             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | z
- regression             | create_property_graph_tests | g3                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | a
- regression             | create_property_graph_tests | g3                  | b             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | b
- regression             | create_property_graph_tests | g3                  | x             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | x
- regression             | create_property_graph_tests | g3                  | y             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | y
- regression             | create_property_graph_tests | g3                  | z             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | z
- regression             | create_property_graph_tests | g4                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | a
- regression             | create_property_graph_tests | g4                  | i             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | i
- regression             | create_property_graph_tests | g4                  | i_j           | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | i_j
- regression             | create_property_graph_tests | g4                  | kk            | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | kk
- regression             | create_property_graph_tests | g4                  | t             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | t
- regression             | create_property_graph_tests | g4                  | x             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | x
- regression             | create_property_graph_tests | g4                  | yy            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | yy
- regression             | create_property_graph_tests | g5                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | a
- regression             | create_property_graph_tests | g5                  | b             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | b
- regression             | create_property_graph_tests | g5                  | c             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | c
- regression             | create_property_graph_tests | g5                  | d             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | d
- regression             | create_property_graph_tests | g5                  | e             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | e
- regression             | create_property_graph_tests | gc1                 | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | a
- regression             | create_property_graph_tests | gc1                 | b             | character varying |                          |                        |                       |                      |                    | regression        | pg_catalog       | C              |                   |                         |               |                    |               |                    | regression                | pg_catalog               | varchar                |               |              |            |                     | b
- regression             | create_property_graph_tests | gc1                 | eb            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | eb
- regression             | create_property_graph_tests | gc1                 | ek1           | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | ek1
- regression             | create_property_graph_tests | gc1                 | ek2           | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | ek2
- regression             | create_property_graph_tests | glc                 | p1            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | p1
- regression             | create_property_graph_tests | glc                 | p2            | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | p2
- regression             | create_property_graph_tests | glc                 | p3            | numeric           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | numeric                |               |              |            |                     | p3
- regression             | create_property_graph_tests | glc                 | p4            | boolean           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | bool                   |               |              |            |                     | p4
- regression             | create_property_graph_tests | gt                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int4                   |               |              |            |                     | a
- regression             | create_property_graph_tests | gt                  | b             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | b
- regression             | create_property_graph_tests | gt                  | c             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | c
- regression             | create_property_graph_tests | gt                  | k1            | bigint            |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | int8                   |               |              |            |                     | k1
- regression             | create_property_graph_tests | gt                  | k2            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | k2
- regression             | create_property_graph_tests | gt                  | m             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | m
- regression             | create_property_graph_tests | gt                  | n             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog               | text                   |               |              |            |                     | n
+ property_graph_catalog |    property_graph_schema    | property_graph_name | property_name |     data_type     | character_maximum_length | character_octet_length | character_set_catalog | character_set_schema | character_set_name | collation_catalog | collation_schema | collation_name | numeric_precision | numeric_precision_radix | numeric_scale | datetime_precision | interval_type | interval_precision | user_defined_type_catalog |  user_defined_type_schema   | user_defined_type_name | scope_catalog | scope_schema | scope_name | maximum_cardinality | dtd_identifier 
+------------------------+-----------------------------+---------------------+---------------+-------------------+--------------------------+------------------------+-----------------------+----------------------+--------------------+-------------------+------------------+----------------+-------------------+-------------------------+---------------+--------------------+---------------+--------------------+---------------------------+-----------------------------+------------------------+---------------+--------------+------------+---------------------+----------------
+ regression             | create_property_graph_tests | g2                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | a
+ regression             | create_property_graph_tests | g2                  | b             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | b
+ regression             | create_property_graph_tests | g2                  | i             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | i
+ regression             | create_property_graph_tests | g2                  | j             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | j
+ regression             | create_property_graph_tests | g2                  | k             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | k
+ regression             | create_property_graph_tests | g2                  | p1            | USER-DEFINED      |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | create_property_graph_tests | t_udt1                 |               |              |            |                     | p1
+ regression             | create_property_graph_tests | g2                  | p2            | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | p2
+ regression             | create_property_graph_tests | g2                  | t             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | t
+ regression             | create_property_graph_tests | g2                  | x             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | x
+ regression             | create_property_graph_tests | g3                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | a
+ regression             | create_property_graph_tests | g3                  | b             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | b
+ regression             | create_property_graph_tests | g3                  | x             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | x
+ regression             | create_property_graph_tests | g3                  | y             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | y
+ regression             | create_property_graph_tests | g3                  | z             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | z
+ regression             | create_property_graph_tests | g4                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | a
+ regression             | create_property_graph_tests | g4                  | i             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | i
+ regression             | create_property_graph_tests | g4                  | i_j           | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | i_j
+ regression             | create_property_graph_tests | g4                  | kk            | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | kk
+ regression             | create_property_graph_tests | g4                  | t             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | t
+ regression             | create_property_graph_tests | g4                  | x             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | x
+ regression             | create_property_graph_tests | g4                  | yy            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | yy
+ regression             | create_property_graph_tests | g5                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | a
+ regression             | create_property_graph_tests | g5                  | b             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | b
+ regression             | create_property_graph_tests | g5                  | c             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | c
+ regression             | create_property_graph_tests | g5                  | d             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | d
+ regression             | create_property_graph_tests | g5                  | e             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | e
+ regression             | create_property_graph_tests | gc1                 | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | a
+ regression             | create_property_graph_tests | gc1                 | b             | character varying |                          |                        |                       |                      |                    | regression        | pg_catalog       | C              |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | varchar                |               |              |            |                     | b
+ regression             | create_property_graph_tests | gc1                 | eb            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | eb
+ regression             | create_property_graph_tests | gc1                 | ek1           | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | ek1
+ regression             | create_property_graph_tests | gc1                 | ek2           | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | ek2
+ regression             | create_property_graph_tests | glc                 | p1            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | p1
+ regression             | create_property_graph_tests | glc                 | p2            | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | p2
+ regression             | create_property_graph_tests | glc                 | p3            | numeric           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | numeric                |               |              |            |                     | p3
+ regression             | create_property_graph_tests | glc                 | p4            | boolean           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | bool                   |               |              |            |                     | p4
+ regression             | create_property_graph_tests | gt                  | a             | integer           |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int4                   |               |              |            |                     | a
+ regression             | create_property_graph_tests | gt                  | b             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | b
+ regression             | create_property_graph_tests | gt                  | c             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | c
+ regression             | create_property_graph_tests | gt                  | k1            | bigint            |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | int8                   |               |              |            |                     | k1
+ regression             | create_property_graph_tests | gt                  | k2            | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | k2
+ regression             | create_property_graph_tests | gt                  | m             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | m
+ regression             | create_property_graph_tests | gt                  | n             | text              |                          |                        |                       |                      |                    | regression        |                  |                |                   |                         |               |                    |               |                    | regression                | pg_catalog                  | text                   |               |              |            |                     | n
 (42 rows)
 
 SELECT * FROM information_schema.pg_property_graph_privileges WHERE grantee LIKE 'regress%' ORDER BY property_graph_name, grantor, grantee, privilege_type;
@@ -831,7 +847,7 @@ CREATE PROPERTY GRAPH create_property_graph_tests.g2
     VERTEX TABLES (
         t1 KEY (a) PROPERTIES (a, b),
         t2 KEY (i) PROPERTIES (i, j, k),
-        t3 KEY (x) LABEL t3l1 PROPERTIES (x, y, z) LABEL t3l2 PROPERTIES (x, y, z)
+        t3 KEY (x) LABEL t3l1 PROPERTIES (ROW(x, 1)::t_udt1 AS p1) LABEL t3l2 PROPERTIES ((ROW(x, 1)::t_udt2).a AS p2)
     )
     EDGE TABLES (
         e1 KEY (a, i) SOURCE KEY (a) REFERENCES t1 (a) DESTINATION KEY (i) REFERENCES t2 (i) PROPERTIES (a, i, t),
@@ -909,7 +925,7 @@ CREATE PROPERTY GRAPH create_property_graph_tests.g2
     VERTEX TABLES (
         t1 KEY (a) PROPERTIES (a, b),
         t2 KEY (i) PROPERTIES (i, j, k),
-        t3 KEY (x) LABEL t3l1 PROPERTIES (x, y, z) LABEL t3l2 PROPERTIES (x, y, z)
+        t3 KEY (x) LABEL t3l1 PROPERTIES (ROW(x, 1)::t_udt1 AS p1) LABEL t3l2 PROPERTIES ((ROW(x, 1)::t_udt2).a AS p2)
     )
     EDGE TABLES (
         e1 KEY (a, i) SOURCE KEY (a) REFERENCES t1 (a) DESTINATION KEY (i) REFERENCES t2 (i) PROPERTIES (a, i, t),
diff --git a/src/test/regress/sql/create_property_graph.sql b/src/test/regress/sql/create_property_graph.sql
index 2b8269d66ec..d74af881639 100644
--- a/src/test/regress/sql/create_property_graph.sql
+++ b/src/test/regress/sql/create_property_graph.sql
@@ -21,8 +21,22 @@ CREATE TABLE t3 (x int, y text, z text);
 CREATE TABLE e1 (a int, i int, t text, PRIMARY KEY (a, i) INCLUDE (t));
 CREATE TABLE e2 (a int, x int, t text);
 
+-- The table types used to test graph properties with user-defined
+-- datatypes.  Unlike other user defined types these types depend upon tables
+-- which have same dump priority as the property graph.  002_pg_upgrade will use
+-- this property graph to test dependency ordering in pg_dump.
+CREATE TABLE t_udt1 (a int, b int);
+CREATE TABLE t_udt2 (a int, b int);
+
 CREATE PROPERTY GRAPH g2
-    VERTEX TABLES (t1 KEY (a), t2 DEFAULT LABEL, t3 KEY (x) LABEL t3l1 LABEL t3l2)
+    VERTEX TABLES (
+        t1 KEY (a),
+        t2 DEFAULT LABEL,
+        t3 KEY (x)
+                   -- property with user-defined type
+                   LABEL t3l1 PROPERTIES ((row(x, 1)::t_udt1) AS p1)
+                   -- property with user-defined type inside expression
+                   LABEL t3l2 PROPERTIES ((row(x, 1)::t_udt2).a AS p2))
     EDGE TABLES (
         e1
             SOURCE KEY (a) REFERENCES t1 (a)
@@ -37,8 +51,10 @@ CREATE PROPERTY GRAPH g2
 DROP TABLE t1;  -- fail
 ALTER TABLE t1 DROP COLUMN b;  -- non-key column; fail
 ALTER TABLE t1 DROP COLUMN a;  -- key column; fail
+DROP TABLE t_udt1;  -- fail
+DROP TABLE t_udt2;  -- fail
 
--- like g2 but assembled with ALTER
+-- property graph assembled using ALTER
 CREATE PROPERTY GRAPH g3;
 ALTER PROPERTY GRAPH g3 ADD VERTEX TABLES (t1 KEY (a), t2 DEFAULT LABEL);
 ALTER PROPERTY GRAPH g3

base-commit: 58ff54aee8b252b23b35c7a6297bf9189731bca3
-- 
2.34.1

