Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix db clear by not dropping automatically created array types #893

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

LukasKalbertodt
Copy link
Member

For each type that we create, postgres adds an additional "array" type of that type. Trying to drop that array type fails with:

ERROR: cannot drop type block_type[] because type block_type requires it
HINT: You can drop type block_type instead.

Deleting the base type also gets rid of the array type. The filter added in this commit seems to do the trick and should work generally. Related: https://www.postgresql.org/docs/current/catalog-pg-type.html

Note that this error occurs only occasionally, depending on what order the type names are returned from our query. In all my tests, the base types were ordered before the array types, hiding the problem. On a production instance, they were ordered differently, that's how I noticed this bug.

For each type that we create, postgres adds an additional "array" type
of that type. Trying to drop that array type fails with:

    ERROR: cannot drop type block_type[] because type block_type requires it
    HINT: You can drop type block_type instead.

Deleting the base type also gets rid of the array type. The filter added
in this commit seems to do the trick and should work generally. Related:
https://www.postgresql.org/docs/current/catalog-pg-type.html

Note that this error occurs only occasionally, depending on what order
the type names are returned from our query. In all my tests, the base
types were ordered before the array types, hiding the problem. On a
production instance, they were ordered differently, that's how I
noticed this bug.
@LukasKalbertodt LukasKalbertodt added the changelog:admin Changes primarily for admins label Jun 28, 2023
@github-actions github-actions bot temporarily deployed to test-deployment-pr893 June 28, 2023 12:26 Destroyed
@owi92 owi92 merged commit 8fc9b11 into elan-ev:master Jun 28, 2023
3 checks passed
@LukasKalbertodt LukasKalbertodt deleted the fix-db-clear-once-more branch June 28, 2023 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:admin Changes primarily for admins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants