Skip to content

Commit

Permalink
Update README.md (Transactions added missing returning *) (#662)
Browse files Browse the repository at this point in the history
Check issue: #649

This is a minor modification but debugging this has taken a couple of hours for me as I am slightly new to SQL syntax and to postgreSQL in general. I was trying to use the empty return from sql.begin but it turned out that the callback in sql.begin was the one returning the empty array even though the insert was successful.
  • Loading branch information
MarisaCodes authored Sep 12, 2023
1 parent 26c368e commit a3b3031
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ const [user, account] = await sql.begin(async sql => {
) values (
'Murray'
)
returning *
`

const [account] = await sql`
Expand All @@ -588,6 +589,7 @@ const [user, account] = await sql.begin(async sql => {
) values (
${ user.user_id }
)
returning *
`

return [user, account]
Expand Down

0 comments on commit a3b3031

Please sign in to comment.