-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: support transactionally dropping a column and creating one with the same name #109587
Comments
Hello, I am Blathers. I am here to help you get the issue triaged. Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here. I have CC'd a few people who may be able to assist you:
If we have not gotten back to your issue within a few business days, you can try the following:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
cc @cockroachdb/disaster-recovery |
This works as a workaround: rename the column first:
|
It's quite possible that's not actually a workaround, but the rename is currently finishing fast enough not to interfere with the drop. This behavior changed in v22.2 when With it enabled, as far as I know, you need to commit both statements individually; begin;
ALTER TABLE "Dog" DROP COLUMN is_good_dog;
commit;
begin;
ALTER TABLE "Dog" ADD COLUMN is_good_dog INTEGER NOT NULL DEFAULT 100;
commit; |
We have work underway that would support this better, but it won't be out until 23.2 or later. Until then, the rename workaround makes sense to use. Is this issue urgent for Prisma? |
(late answer) No, it does not look urgent for Prisma. Thanks! |
Were now at v24.2.4 (atleast at our paid cluster) and this is still a problem in our case its with indexes that couldn`t be dropped and created in the same statement. Is there any new plan or ETA? |
Describe the problem
This works with PostgreSQL but not with CockroachDB
To Reproduce
See error
Expected behavior
It should just work
Environment:
Additional context
Spotted in Prisma Migrate test: https://github.com/prisma/prisma-engines/blob/44742ac2c7c57c525d1ab277dd9fd9496eb92d8b/schema-engine/sql-migration-tests/tests/migrations/cockroachdb/failure_modes.rs#L100-L129
See
prisma/prisma#20851
prisma/prisma#20707
Related cockroach db issue about indexes #98494
Jira issue: CRDB-31009
Epic CRDB-31472
The text was updated successfully, but these errors were encountered: