Skip to content

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

Open
@wedgybo

Description

@wedgybo

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions