Skip to content

Commit d354edf

Browse files
committed
Fix unsafe queries wrongly making named prepared statements
1 parent 63f3212 commit d354edf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function Postgres(a, b) {
200200

201201
function send(connection, query, xs, args) {
202202
connection
203-
? process.nextTick(connection.send, query, query.raw ? parseRaw(xs, args) : parse(query, xs, args))
203+
? process.nextTick(connection.send, query, query.raw ? parseRaw(query, xs, args) : parse(query, xs, args))
204204
: queries.push({ query, xs, args })
205205
}
206206

@@ -364,7 +364,7 @@ function Postgres(a, b) {
364364
.then(() => clearTimeout(destroy))
365365
}
366366

367-
function parseRaw(str, args = []) {
367+
function parseRaw(query, str, args = []) {
368368
const types = []
369369
, xargs = args.map(x => {
370370
const type = getType(x)
@@ -373,7 +373,7 @@ function Postgres(a, b) {
373373
})
374374

375375
return {
376-
sig: types + str,
376+
sig: !query.dynamic && types + str,
377377
str,
378378
args: xargs
379379
}

0 commit comments

Comments
 (0)