Skip to content

Commit 1e2e298

Browse files
committed
Fix missing columns for queries using the simple protocol - fixes #350
1 parent 51269ce commit 1e2e298

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/connection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
565565
return errored(Errors.generic('UNSAFE_TRANSACTION', 'Only use sql.begin or max: 1'))
566566

567567
if (query.options.simple)
568-
return
568+
return BindComplete()
569569

570570
if (query.cursorFn) {
571571
result.count && query.cursorFn(result)

tests/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,10 @@ t('unsafe simple', async() => {
612612
return [1, (await sql.unsafe('select 1 as x'))[0].x]
613613
})
614614

615+
t('unsafe simple includes columns', async() => {
616+
return ['x', (await sql.unsafe('select 1 as x').values()).columns[0].name]
617+
})
618+
615619
t('listen and notify', async() => {
616620
const sql = postgres(options)
617621
const channel = 'hello'

0 commit comments

Comments
 (0)