Skip to content

Commit 83009ea

Browse files
fix: add docs on data types that can be used as ids for :execlastid annotation
1 parent 7f0feb8 commit 83009ea

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

docs/04_Postgres.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
<details>
33
<summary>:execlastid - Implementation</summary>
44

5-
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id, which can be of any
6-
data type that can have a unique constraint.
5+
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id.
6+
The data types that can be used as id data types for this annotation are:
7+
1. uuid
8+
2. bigint
9+
3. integer
10+
4. smallint (less recommended due to small id range, but possible)
11+
12+
```sql
13+
INSERT INTO tab1 (field1, field2) VALUES ('a', 1) RETURNING id_field;
14+
```
715
</details>
816

917
<details>

docs/06_Sqlite.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
<summary>:execlastid - Implementation</summary>
44

55
## :execlastid - Implementation
6-
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id, which can be of any
7-
data type that can have a unique constraint.
8-
6+
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id.
7+
Only integer data type is supported as id for this annotation.
8+
99
```sql
1010
INSERT INTO tab1 (field1, field2) VALUES ('a', 1) RETURNING id_field;
1111
```
12-
1312
</details>
1413

1514
<details>

0 commit comments

Comments
 (0)