diff --git a/docs/tutorials/getting-started-postgresql.md b/docs/tutorials/getting-started-postgresql.md index 4a4943d3bc..873e9ad2cb 100644 --- a/docs/tutorials/getting-started-postgresql.md +++ b/docs/tutorials/getting-started-postgresql.md @@ -60,6 +60,24 @@ DELETE FROM authors WHERE id = $1; ``` +For SQL UPDATE if you do not want to return the updated record to the user, add this to the `query.sql` file: +```sql +-- name: UpdateAuthor :exec +UPDATE authors +set name = $2, +bio = $3 +WHERE id = $1; +``` +Otherwise, to return the updated record back to the user, add this to the `query.sql` file: +```sql +-- name: UpdateAuthor :one +UPDATE authors +set name = $2, +bio = $3 +WHERE id = $1 +RETURNING *; +``` + You are now ready to generate code. Run the `generate` command. You shouldn't see any errors or output. ```shell