drizzle-team / drizzle-team/drizzle-orm

[BUG]:arrayJoin doesn't seem to work with string arrays

Open
#4,034 0 comments 3 reactions 0 assignees View on GitHub
db/postgres improvement qb/crud
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.0

### What version of `drizzle-kit` are you using?

0.30.3

### Other packages

_No response_

### Describe the Bug

The following query `arrayOverlaps` where clause resulted in an unexpected `ERR error: operator does not exist: text[] && record` error

```
.where(
and(
eq(table.organizationId, orgId),
arrayOverlaps(table.messageIds, questionIds),
),
);
```

This exact replacement **does** work:
```
const formattedIds = questionIds.map(id => `'${id}'`).join(', ');

.where(
and(
eq(table.organizationId, orgId),
sql.raw(`table.message_ids && ARRAY[${formattedIds}]::text[]`),
),
```

Also tried using `sql\`` variations and not seemed to work, had to use sql.raw() in the end.

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.