[PATCH] Postpone PROPERTY GRAPH creation in pg_dump to POST-DATA when it depends on a unique constraint

From: SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Postpone PROPERTY GRAPH creation in pg_dump to POST-DATA when it depends on a unique constraint
Date: 2026-05-10 14:38:38
Message-ID: CAHg+QDdftgQNe4Ss9OZf3NmOY3HD=_PTz2m+7hE+1C31yxheNg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

A property graph that references a vertex (or edge) table with a
PRIMARY KEY creates a circular dependency for pg_dump.

When we dump the database with such a table pg_dump emitted a
'could not resolve dependency loop' warning and then wrote the
property graph in PRE-DATA before the ADD CONSTRAINT line that
creates the required unique index. On a restore, the
CREATE PROPERTY GRAPH then errored out with 'there is no unique
constraint matching the key for element ...', leaving the property
graph silently absent from the restored database.

The fix is to resolve it the same way as for materialized views. When a
property graph is involved in a multi-object loop with the PRE-DATA
boundary,
break the boundary's dependency on it and postpone the property graph
into POST-DATA via the existing TableInfo.postponed_def flag (already
honoured by the section assignment in dumpTableSchema()).
As part of the change I renamed repairMatViewBoundaryMultiLoop to
repairPostponableBoundaryMultiLoop. This function now handles both
matview and and propgraph. Patch includes a test.

Thanks,
Satya

Attachment Content-Type Size
0001-pg_dump-postpone-PROPERTY-GRAPH-into-POST-DATA-when-.patch application/octet-stream 8.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2026-05-10 15:00:00 Re: Random pg_upgrade 004_subscription test failure on drongo
Previous Message jian he 2026-05-10 14:23:26 Re: COPY FROM with RLS