-
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: alter column type in transaction not supported #49351
Comments
Any updates on this? |
@Anticom This won't be fixed in the upcoming 21.1 release but our team is working on the underlying changes needed to support hopefully later in 2021. |
Checking in on this one, it's come up again in an attempted migration from 20.1 to 21.1 |
ALTER transactions are used by the Piccolo ORM automatic migration tool. Would be a great lightweight tool for free, open source migrations that aren't SQLAlchemy. 😉 |
Also creeps up with Django migrations with from django.db import migrations, models
class Migration(migrations.Migration):
migrations.CreateModel(
name='model1',
fields=[
('field1', models.DateField()),
] This causes from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_auto_20220903_1024'),
]
operations = [
migrations.AlterField(
model_name='model1',
name='field1',
field=models.DateTimeField(blank=True, null=True),
),
] |
Where are we on this? running v22.2 and still getting this error. is there a cluster setting we can turn on? |
Same problem for Prisma: prisma/prisma#20557 Is there a workaround we could implement to somehow get these migrations done anyway? |
The short term fix is don't do the migration in a transaction. For better ORM compatibility, I think there's an argument to be made for CRDB to just ignore the transaction part for schema changes- as I don't see a real fix any time soon, but it's a pressing issue for a lot of ORM's. |
Hello guys, were are we on this issue? |
+1 for prioritization on this |
I know my org is still waiting for this before we dump our old postgres ha cluster. Aaaaany day now ;) |
Is there any progress on this issue? |
+1 for prioritizing this issue. Would need this to migrate from Postgres to Cockroach. |
Is this issue resolved yet?? |
+1 |
Is there any hope of getting this done? It has been several years now after it has been said it was being worked on and was supposed to be done later in 2021. There are many applications out there that use this in their migrations, and when CockroachDB claims to be PostgreSQL compatible but then does not work for things like this, it makes it really hard to use for things! |
any updates on the issue ? |
With the current schema changer infrastructure, it's difficult to support alter column type in transactions. This is because the computed column swap doesn't actually occur until the transaction is committed. Thus any references to the column being altered will be done on the original column and not the column after the swap.
Here is an example with adding a constraint to an altered column
Allowing alter column type in transactions will likely depend on supporting transactional schema changes in general.
Similarly, ALTER COLUMN TYPE cannot be used in combination with other ALTER TABLE statements since this runs the statements inside a transaction.
Example:
ALTER TABLE t ALTER COLUMN x TYPE STRING, ALTER COLUMN x SET NOT NULL;
Jira issue: CRDB-4235
Epic CRDB-25314
The text was updated successfully, but these errors were encountered: