drizzle-team / drizzle-team/drizzle-orm

[BUG]: drizzle-arktype puts int64 limits on `PgNumericBigInt` column

Open
#5,146 3 comments 0 reactions 0 assignees View on GitHub
bug drizzle/arktype
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.45.1

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

0.31.8

### Other packages

drizzle-arktype@0.1.3

### Describe the Bug

Consider the following schema:

```
const bigValue = 100000000000000000000n;

const testSchema = pgTable("test_test", {
testProp: numeric({
mode: "bigint",
precision: 78,
scale: 0,
}).notNull(),
});

const arkSchema = createSelectSchema(testSchema);
```

I would expect `arkSchema` to just use arktypes `"bigint"` validator, but instead it validates it against the int64-ranges as defined [here](https://github.com/drizzle-team/drizzle-orm/blob/a086f59fba7f46f3a077893ba912c99e91eaa760/drizzle-arktype/src/column.ts#L235-L237).

This might have been added as a protective layer when creating an insert-schema with a proper `bigint`/`int64` column, but in a select-schema I don't see a good reason to even have any constraints on it.

My proposal would be to add a special handling for PgNumericBigInt columns, that just passes values on to the arktype `"bigint"` validator, without a range-check.

Let me know if this would be a PR that would be accepted. For now, I'll patch it on my side.

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.