drizzle-team / drizzle-team/drizzle-orm

[BUG]: When querying PostgreSQL with the Bun driver, the milliseconds in timestamp fields are truncated.

Open
#5,062 2 comments 0 reactions 0 assignees View on GitHub
bug bug/fixed-in-beta
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.44.7

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

0.31.7

### Other packages

_No response_

### Describe the Bug

```
bun -v
1.3.3
```

```typescript
// db.ts
import { drizzle } from "drizzle-orm/bun-sql";
import * as schema from "./schema";

export const db = drizzle(process.env.DATABASE_URL, { schema });
```

```typescript
// schema.ts
import {
pgTable,
text,
uuid,
integer,
timestamp,
bigint,
} from "drizzle-orm/pg-core";

export const workTable = pgTable("work", {
workno: text("workno").unique().notNull(),
name: text("name").notNull(),
_updatedAt: timestamp("_updated_at", { precision: 3 }).notNull(),
});
```

```
// main.ts

async function main() {
const result = await db.query.workTable.findMany();
console.log(result[0]?._updatedAt);
console.log(typeof result[0]?._updatedAt);
}
```
drizzle-orm query returns
```
2025-11-22T06:52:33.000Z
object
```
but in DB that is
```
"2025-11-22 06:52:33.955"
```
and when set
```
_updatedAt: timestamp("_updated_at", {
mode: "string",
precision: 3,
}).notNull(),
```
timestamp columns showing string type, however actually returning a right Date object
```
2025-11-21T22:52:33.955Z
object
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the timestamp query using db.ts, schema.ts, and main.ts with the drizzle-orm/bun-sql entry point and PostgreSQL precision 3. Trace how the Bun driver parses timestamp values, then verify that milliseconds are preserved and the configured Date or string mode is respected.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, postgresql, typescript
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.