Skip to content

Commit

Permalink
docs: correct reason to name prepared statements for pg (#122)
Browse files Browse the repository at this point in the history
pg has only ever had true parameterized queries.
  • Loading branch information
charmander committed Jan 29, 2020
1 parent 7be1d2a commit 7e6cad0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -117,8 +117,8 @@ query.text // => 'SELECT name FROM books WHERE author = ANY($1)'
query.values // => ['J. K. Rowling', 'J. R. R. Tolkien']
```

## Prepared Statements in Postgres
Postgres requires prepared statements to be named, otherwise the parameters will be escaped and replaced on the client side.
## Named Prepared Statements in Postgres
Postgres has the option of naming prepared statements, which allows parsing and other work to be reused (and requires the SQL associated with the name to stay the same, with only the parameters changing).
You can set the name with the `setName()` method:

```js
Expand Down

0 comments on commit 7e6cad0

Please sign in to comment.