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

[BUG]: ValidationException: Multistatements aren't supported. Driver: aws-data-api #4252

Open
1 task done
wedgybo opened this issue Mar 11, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@wedgybo
Copy link

wedgybo commented Mar 11, 2025

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.39.3

What version of drizzle-kit are you using?

0.30.4

Other packages

No response

Describe the Bug

When changing a primary key on a table the command will fail because AWS Serverless V2 does not support multistatements when using drizzle-kit push

It failed in this Pg Convertor

    PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
      can(statement, dialect6) {
        return statement.type === "alter_composite_pk" && dialect6 === "postgresql";
      }
      convert(statement) {
        const { name, columns } = PgSquasher.unsquashPK(statement.old);
        const { name: newName, columns: newColumns } = PgSquasher.unsquashPK(
          statement.new
        );
        const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
        return `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${statement.oldConstraintName}";
${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newConstraintName}" PRIMARY KEY("${newColumns.join('","')}");`;
      }
    };

Even though the return statement uses the BREAKPOINT token to split this query into two statements. It doesn't seem to work and throws the following error.

ValidationException: Multistatements aren't supported.

There also appears to be an issue where if you have more than two columns in your primary key, it always wants to drop and recreate your constraint, but that's a separate issue that I'll look into more before reporting properly

@wedgybo wedgybo added the bug Something isn't working label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant