CSCfi / CSCfi/rems

Inconsistent SQL function types

Open
#2,963 0 comments 0 reactions 0 assignees View on GitHub
Investigate Technical Debt
Dominant language
Clojure
Stars
66
Forks
28
Avg merge
7d 4h
Merged PRs (30d)
2

Description

Our SQL statements seem to have inconsitent types. The ones with `RETURNING` clause are:

With `:returning-execute`

```sql
-- :name add-application-event! :returning-execute :1
```

With plain `:insert`

```sql
-- :name create-application! :insert
-- :name put-to-outbox! :insert
-- :name add-organization! :insert
-- :name add-invitation! :insert
```

Is there a problem here?
See https://www.hugsql.org/using-hugsql/insert#option-1-insert--returning

Looks like if you intend to return more than just the generater id, you need to use the former.

Let's refactor so that we use only the latter `:insert` since it reads a bit better, and returning many values is basically extra.

- [ ] replace cases with `:returning-execute` with `:insert` and rewrite the code to not access the body result (`fix-event-from-db`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.