Skip to content

Commit 1b1de87

Browse files
committed
Support .toPostgres() on Array-derived objects
Related to brianc#2012. Since we cannot disambiguate between Arrays that should be converted to PostgreSQL array types and Arrays that should be treated as JSON, make it at least possible to define custom Array-derived types. This also makes it possible to properly serialize Array-derived multirange collections where elements must not be independently escaped.
1 parent 3c48f22 commit 1b1de87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/pg/lib/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ var prepareValue = function (val, seen) {
6666
return dateToString(val)
6767
}
6868
}
69-
if (Array.isArray(val)) {
69+
if (Array.isArray(val) && val.toPostgres !== 'function') {
7070
return arrayString(val)
7171
}
7272
if (typeof val === 'object') {

0 commit comments

Comments
 (0)