{
  "schemaVersion": "ebb.rule.v1",
  "id": "database.postgresql.end-of-life-13",
  "ecosystem": "database",
  "purl": "pkg:generic/postgresql",
  "affectedVersions": "vers:semver/>=13.0.0|<14.0.0",
  "event": "end-of-life",
  "severity": "high",
  "title": "PostgreSQL 13 is no longer a supported major version",
  "summary": "The PostgreSQL Global Development Group lists 13 as unsupported: its final release was on November 13, 2025, so it receives no further bug or security fixes. A database image tag or managed engine_version on this line runs unsupported software.",
  "replacement": "PostgreSQL 16 or later",
  "deadline": "2025-11-13",
  "sources": [
    {
      "title": "PostgreSQL versioning policy",
      "url": "https://www.postgresql.org/support/versioning/",
      "accessedAt": "2026-10-22"
    },
    {
      "title": "endoflife.date: PostgreSQL",
      "url": "https://endoflife.date/postgresql",
      "accessedAt": "2026-10-22"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-22",
    "reviewedAt": "2026-10-22",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "A PostgreSQL data directory written by one major version cannot be started by another. Changing the image tag of a service that has a volume will fail or, worse, start with an empty database.",
      "Upgrade with pg_upgrade or a dump and restore (pg_dumpall, then psql), and move to a supported major in one planned change instead of one major at a time unless the tool you use requires it.",
      "For managed databases, engine_version changes do not apply major upgrades unless allow_major_version_upgrade is set; plan the maintenance window before applying."
    ],
    "steps": [
      {
        "id": "back-up-data",
        "title": "Back up the data first",
        "instructions": "Take a verified backup or snapshot of every PostgreSQL instance in the reported files before changing any version. A major version change is not reversible by changing the version back.",
        "targets": "all"
      },
      {
        "id": "upgrade-data",
        "title": "Upgrade the database cluster",
        "instructions": "Run the upgrade with pg_upgrade or restore a dump into a new instance on the target major version. On a managed database, upgrade through a snapshot restore or a reviewed engine_version change with allow_major_version_upgrade.",
        "targets": "declaration"
      },
      {
        "id": "raise-declared-version",
        "title": "Raise the declared version",
        "instructions": "Change the image tag in Compose files, or engine_version in Terraform, to the release in the replacement. Do this in every file and environment that runs this database, not only the reported line.",
        "targets": "all"
      },
      {
        "id": "align-clients",
        "title": "Check clients and tooling",
        "instructions": "Update drivers, ORMs, CI service containers, and local setup documentation that assume the old PostgreSQL version.",
        "targets": "all"
      }
    ],
    "verification": [
      {
        "command": "docker compose config",
        "purpose": "Confirm the Compose file is valid and shows the intended PostgreSQL image tag after the change."
      },
      {
        "command": "terraform validate",
        "purpose": "Check that the Terraform configuration is valid with the new engine_version."
      },
      {
        "command": "terraform plan",
        "purpose": "Review the plan and confirm the engine_version change is the only database change, and that it is intended."
      }
    ]
  }
}
