<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6" -->

---
title: Fix circular role dependencies before upgrading Amazon...
description: Upgrading Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL from version 14 or earlier to 15 or later can stall or roll back if a circular role dependency...
canonical: https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Fix circular role dependencies before upgrading Amazon RDS and Amazon Aurora PostgreSQL | daily.dev
og:description: Upgrading Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL from version 14 or earlier to 15 or later can stall or roll back if a circular role dependency...
og:url: https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6
og:image: https://api.daily.dev/og/posts/NUxfkHMZ6.png
og:image:alt: Fix circular role dependencies before upgrading Amazon RDS and Amazon Aurora PostgreSQL
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Fix circular role dependencies before upgrading Amazon RDS and Amazon Aurora PostgreSQL

**[AWS Database Blog](https://daily.dev/sources/aws-database-blog)** · 8 min read · 0 upvotes · 0 comments

## Summary

Upgrading Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL from version 14 or earlier to 15 or later can stall or roll back if a circular role dependency exists between rds_superuser and the built-in pg_write_all_data or pg_read_all_data roles. The upgrade process grants these built-in roles to rds_superuser, and if a reverse membership already exists (direct or transitive), PostgreSQL blocks the grant because role memberships must remain acyclic. A diagnostic SQL query is provided to walk the membership graph and detect any offending paths before upgrading, along with steps to revoke the loop-closing membership and best practices to avoid the issue in future upgrades.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://aws.amazon.com/blogs/database/resolve-circular-role-dependencies-during-upgrades-of-amazon-rds-for-postgresql-and-amazon-aurora>

## Questions this post answers

### Why does my Amazon RDS PostgreSQL major version upgrade from 14 to 15 fail or roll back?

It fails when a circular role dependency exists between rds_superuser and the built-in pg_write_all_data or pg_read_all_data roles. During the upgrade to PostgreSQL 15 or later, the service grants pg_write_all_data and pg_read_all_data to rds_superuser; if one of those roles is already a member of rds_superuser directly or transitively, the grant would close a membership loop, which PostgreSQL disallows, so the upgrade fails and rolls back.

_Track PostgreSQL upgrade gotchas like this on daily.dev before you schedule a major version bump._

### How do I check for circular role dependencies before upgrading PostgreSQL on RDS or Aurora?

Run a diagnostic SQL query as the primary user on the PostgreSQL 14 or earlier database that walks the membership graph starting from rds_superuser and returns any path reaching pg_write_all_data or pg_read_all_data. If the query returns no rows, the database is unaffected; any returned rows show the end_role and intermediate_roles path that must be resolved by revoking the loop-closing membership before upgrading.

_Developers planning RDS or Aurora upgrades can find pre-upgrade checks like this via daily.dev._

### Does the pg_write_all_data and pg_read_all_data circular role issue affect databases already running PostgreSQL 15?

No, this issue only affects upgrades moving from PostgreSQL 14 or earlier to PostgreSQL 15 or later, because that is when Amazon RDS and Aurora first grant pg_write_all_data and pg_read_all_data to rds_superuser. A database already running PostgreSQL 15 or later has already received these grants and will not hit the same rollback during later upgrades.

_Stay ahead of version-specific database quirks like this by following PostgreSQL updates on daily.dev._

## Similar posts on daily.dev

- [The Version Number Is Not the Territory](https://daily.dev/posts/the-version-number-is-not-the-territory-fzlch2e1p) · Planet PostgreSQL · 0 upvotes · 0 comments
- [PostgreSQL 18 on Amazon Aurora and Amazon RDS: Security, monitoring, and developer enhancements](https://daily.dev/posts/postgresql-18-on-amazon-aurora-and-amazon-rds-security-monitoring-and-developer-enhancements-9ik7lifyc) · AWS Database Blog · 0 upvotes · 0 comments
- [Amazon Aurora now supports PostgreSQL 18.4, 17.10, 16.14, 15.18, and 14.23](https://daily.dev/posts/amazon-aurora-now-supports-postgresql-18-4-17-10-16-14-15-18-and-14-23-a3wx1kzhv) · AWS · 0 upvotes · 0 comments

---

Tags: [#aws](https://daily.dev/tags/aws), [#database](https://daily.dev/tags/database), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Fix circular role dependencies before upgrading Amazon RDS and Amazon Aurora PostgreSQL","url":"https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6"},"datePublished":"2026-08-31T23:47:47.236Z","dateModified":"2026-09-01T00:44:10.341Z","description":"Upgrading Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL from version 14 or earlier to 15 or later can stall or roll back if a circular role dependency...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/397b6f02e7481cbe251216b065a585a3?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/397b6f02e7481cbe251216b065a585a3?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"AWS Database Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"AWS Database Blog","logo":"https://media.daily.dev/image/upload/s--En-avd2a--/f_auto,q_auto/v1780213446/logos/aws-database-blog?_a=BAMAMiWQ0","url":"https://daily.dev/sources/aws-database-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"aws,database,postgresql","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AWS Database Blog","item":"https://daily.dev/sources/aws-database-blog"},{"@type":"ListItem","position":3,"name":"Fix circular role dependencies before upgrading Amazon RDS and Amazon Aurora PostgreSQL"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/fix-circular-role-dependencies-before-upgrading-amazon-rds-and-amazon-aurora-postgresql-nuxfkhmz6#faq","mainEntity":[{"@type":"Question","name":"Why does my Amazon RDS PostgreSQL major version upgrade from 14 to 15 fail or roll back?","acceptedAnswer":{"@type":"Answer","text":"It fails when a circular role dependency exists between rds_superuser and the built-in pg_write_all_data or pg_read_all_data roles. During the upgrade to PostgreSQL 15 or later, the service grants pg_write_all_data and pg_read_all_data to rds_superuser; if one of those roles is already a member of rds_superuser directly or transitively, the grant would close a membership loop, which PostgreSQL disallows, so the upgrade fails and rolls back. Track PostgreSQL upgrade gotchas like this on daily.dev before you schedule a major version bump."}},{"@type":"Question","name":"How do I check for circular role dependencies before upgrading PostgreSQL on RDS or Aurora?","acceptedAnswer":{"@type":"Answer","text":"Run a diagnostic SQL query as the primary user on the PostgreSQL 14 or earlier database that walks the membership graph starting from rds_superuser and returns any path reaching pg_write_all_data or pg_read_all_data. If the query returns no rows, the database is unaffected; any returned rows show the end_role and intermediate_roles path that must be resolved by revoking the loop-closing membership before upgrading. Developers planning RDS or Aurora upgrades can find pre-upgrade checks like this via daily.dev."}},{"@type":"Question","name":"Does the pg_write_all_data and pg_read_all_data circular role issue affect databases already running PostgreSQL 15?","acceptedAnswer":{"@type":"Answer","text":"No, this issue only affects upgrades moving from PostgreSQL 14 or earlier to PostgreSQL 15 or later, because that is when Amazon RDS and Aurora first grant pg_write_all_data and pg_read_all_data to rds_superuser. A database already running PostgreSQL 15 or later has already received these grants and will not hit the same rollback during later upgrades. Stay ahead of version-specific database quirks like this by following PostgreSQL updates on daily.dev."}}]}
```

