Skip to content

Commit f406426

Browse files
committed
Call socket.write with correct arguments - fixes porsager#216
1 parent 3c3247b commit f406426

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/connection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ function Connection(options = {}) {
240240
if (multi())
241241
return
242242

243-
messages.forEach(socket.write)
243+
messages.forEach(x => socket.write(x))
244244
messages = []
245245
open = true
246246
}

tests/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,3 +1467,18 @@ t('Recreate prepared statements on RevalidateCachedQuery error', async() => {
14671467
await sql`drop table test`
14681468
]
14691469
})
1470+
1471+
t('multiple queries before connect', async() => {
1472+
const sql = postgres({ ...options, max: 2 })
1473+
const xs = await Promise.all([
1474+
sql`select 1 as x`,
1475+
sql`select 2 as x`,
1476+
sql`select 3 as x`,
1477+
sql`select 4 as x`
1478+
])
1479+
1480+
return [
1481+
'1,2,3,4',
1482+
xs.map(x => x[0].x).join()
1483+
]
1484+
})

0 commit comments

Comments
 (0)