You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10
Original file line number
Diff line number
Diff line change
@@ -408,6 +408,16 @@ prexit(async () => {
408
408
409
409
```
410
410
411
+
## Numbers, bigint, numeric
412
+
413
+
`Number` in javascript is only able to represent 2<sup>53</sup>-1 safely which means that types in PostgreSQLs like `bigint` and `numeric` won't fit into `Number`.
414
+
415
+
Since Node.js v10.4 we can use [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) to match the PostgreSQL type `bigint`, so Postgres.js will use BigInt if running on v10.4 or later. For older versions `bigint` will be returned as a string.
416
+
417
+
There is currently no way to handle `numeric / decimal` in a native way in Javascript, so these and similar will be returned as `string`.
418
+
419
+
You can of course handle types like these using [custom types](#types) if you want to.
420
+
411
421
## The Connection Pool
412
422
413
423
Connections are created lazily once a query is created. This means that simply doing const `sql = postgres(...)` won't have any effect other than instantiating a new `sql` instance.
0 commit comments