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

tools/reset_database.py should remove postgres types #4212

Closed
bziemons opened this issue Jan 4, 2021 · 2 comments · Fixed by #4723
Closed

tools/reset_database.py should remove postgres types #4212

bziemons opened this issue Jan 4, 2021 · 2 comments · Fixed by #4723
Assignees
Milestone

Comments

@bziemons
Copy link
Member

bziemons commented Jan 4, 2021

Motivation

Since the sqlalchemy update (#4133) I am getting errors that types already exist on postgres after resetting the database (with or without --drop-everything) in my docker-compose environment.

Modification

Since the tools/reset_database.py script is meant to "destroy" the database and leave nothing behind, one option would be to remove all types found in the database.

@mlassnig
Copy link
Contributor

mlassnig commented Jan 4, 2021

Correct, this is because the types always end up in the public schema of PostgreSQL.

Quickest way to do this, in two steps:

drop schema if exists public cascade;
create schema public;

@bziemons
Copy link
Member Author

bziemons commented Jan 4, 2021

That seems to help a bit, but some types seem to be in the dev schema and aren't removed either:

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateObject) type "RULES_HIST_RECENT_DIDTYPE_CHK" already exists

[SQL: CREATE TYPE dev."RULES_HIST_RECENT_DIDTYPE_CHK" AS ENUM ('F', 'D', 'C', 'A', 'X', 'Y', 'Z')]

bziemons added a commit to bziemons/rucio that referenced this issue Jul 7, 2021
according to the [wiki site](https://github.com/sqlalchemy/sqlalchemy/wiki/DropEverything).
Drop schema when dropping everything (will be re-created anyway).
Drop enum types for postgres.
bziemons added a commit to bziemons/rucio that referenced this issue Jul 16, 2021
according to the [wiki site](https://github.com/sqlalchemy/sqlalchemy/wiki/DropEverything).
Drop schema when dropping everything (will be re-created anyway).
Drop enum types for postgres.
bziemons added a commit to bziemons/rucio that referenced this issue Jul 16, 2021
according to the [wiki site](https://github.com/sqlalchemy/sqlalchemy/wiki/DropEverything).
Drop schema when dropping everything (will be re-created anyway).
Drop enum types for postgres.
bziemons added a commit to bziemons/rucio that referenced this issue Jul 22, 2021
according to the [wiki site](https://github.com/sqlalchemy/sqlalchemy/wiki/DropEverything).
Drop schema when dropping everything (will be re-created anyway).
Drop enum types for postgres.
bari12 added a commit that referenced this issue Jul 23, 2021
…es_in_drop_everything

Database: Update drop_everything method; Fix #4212
bari12 pushed a commit that referenced this issue Jul 23, 2021
according to the [wiki site](https://github.com/sqlalchemy/sqlalchemy/wiki/DropEverything).
Drop schema when dropping everything (will be re-created anyway).
Drop enum types for postgres.
@bari12 bari12 added this to the 1.26.1 milestone Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants