Skip to content

Schema editor uses wrong database #255

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

Open
Chainfire opened this issue Dec 9, 2024 · 0 comments
Open

Schema editor uses wrong database #255

Chainfire opened this issue Dec 9, 2024 · 0 comments

Comments

@Chainfire
Copy link

With a multiple database setup (and using "default": {} or with the dummy backend to catch programming errors), creating partitioned tables works, but add partitions to it does not.

For example, PostgresSchemaEditor::add_hash_partition uses a naked transaction.atomic() call. As the database to use (using=) is not specified, Django will create a transaction on the default database rather than the target database, and this will fail if no default database is configured. If a default database is configured, the transaction will execute there which is also not good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant