An Azure managed PostgreSQL database service for app development and deployment.
Hello soriano morales, miguel angel (ext),
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you are having critical OID Mismatch and Data Type Casting Errors during pg_restore on Azure Database for PostgreSQL with Apache AGE Extension.
Running Apache AGE on Azure’s managed PostgreSQL cannot ensure stable OIDs, so the only reliable path is to shift the workload to a self‑hosted PostgreSQL instance or Azure VM. This setup gives full control over system catalogs and prevents OID regeneration during restores. It also aligns properly with AGE’s internal graph ID structure. Official PostgreSQL design confirms that catalog OIDs are not preserved on managed services: https://www.postgresql.org/docs/current/datatype-oid.html.
To maintain graph integrity without casting failures or ID corruption, physical binary backups must replace pg_dump/pg_restore. Using pg_basebackup ensures that every catalog entry, graph label, and graph OID is restored exactly as originally written. This method avoids Azure’s casting restrictions that block graphid conversions. - https://www.postgresql.org/docs/current/app-pgbasebackup.html.
Deploying PostgreSQL + Apache AGE on an Azure VM preserves the benefits of cloud hosting while restoring full low‑level database control. You can install AGE manually, customize extension behavior, and manage storage snapshots as needed for disaster recovery. Full cluster snapshots eliminate bigint overflows caused by graph ID remapping attempts. Azure VM deployment guidance: https://learn.microsoft.com/azure/virtual-machines/linux/quick-create-portal.
Finally, graph ID repair through casting or recomputation must never be attempted, as Azure’s managed engine blocks these operations for internal type safety. Preserving original graph IDs is only possible through physical cluster‑level backups. Avoid all attempts to convert or reinterpret graphid, since AGE encodes the OID and local identifier internally. Check this Apache AGE documentation.
I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.