drizzle-team / drizzle-team/drizzle-orm

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

Open
#4,252 0 comments 0 reactions 0 assignees View on GitHub
bug driver/aws-data-api drizzle/kit
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.