Skip to content

Resource cache cleanup errors with Postgresql 18 #9619

Closed

Description

@taylorsilva

I bumped the concourse/unit image to use Postgresql 18. The atc/db unit tests started failing with:

ERROR: update or delete on table "resource_configs" violates RESTRICT setting of foreign key constraint "resource_caches_resource_config_id_fkey" on table "resource_caches" (SQLSTATE 23001)

I happened to see this randomly happen yesterday as well, I think because the latest postgres image on Docker hub started using using v18.

Appears to be an issue with applying the migrations. Feels race-y because it doesn't happen every time. Would only be an issue for someone creating a new Concourse cluster. Weird that it happens to an empty DB though.

Activity

  1. added theissue type on Jun 24, 2026
  2. changed the title [-]Error applying migrations with Postgresql 18[/-] [+]Error applying migrations with Postgresql 18 (new Concourse db only)[/+] on Jun 24, 2026
  3. taylorsilva commented on Jun 24, 2026

    @taylorsilva
    MemberAuthor

    Not a migration issue! Postgres 18 returns a different error, which is why two of the tests were failing. A third test is failing for a different reason; getting a failure when we shouldn't:

    Expect(resourceCacheLifecycle.CleanUpInvalidCaches(logger)).To(Succeed())

  4. changed the title [-]Error applying migrations with Postgresql 18 (new Concourse db only)[/-] [+]Resource cache cleanup errors with Postgresql 18[/+] on Jun 24, 2026
  5. Kump3r commented on Jun 26, 2026

    @Kump3r
    Contributor

    Figured it out in PG18, the ForeignKeyViolation race we were handling, actually changed to a new status (23001) which is RestrictViolation. I can try to prepare a fix to unblock failing CI tests. - https://pkg.go.dev/github.com/jackc/pgerrcode#section-readme #class 23

    Edit: Fix #9621

  6. self-assigned this
    on Jun 26, 2026
  7. taylorsilva commented on Jun 26, 2026

    @taylorsilva
    MemberAuthor

    Thanks Kalin! Was just about to circle back to this and felt so much relief seeing your PR!

  8. Kump3r commented on Jun 26, 2026

    @Kump3r
    Contributor

    Hey, no problem it was simple enough. Teamwork makes the dream work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions