Skip to content

Commit f254c23

Browse files
committed
Document lazy execution - fixes #429
1 parent 83c9109 commit f254c23

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const xs = await sql`
127127
// xs = [{ user_id: 1, name: 'Murray', age: 68 }]
128128
```
129129

130-
> Please note that queries are first executed when `awaited` – or manually by using `.execute()`.
130+
> Please note that queries are first executed when `awaited` – or instantly by using [`.execute()`](#execute).
131131
132132
### Query parameters
133133

@@ -483,6 +483,12 @@ setTimeout(() => query.cancel(), 100)
483483
const result = await query
484484
```
485485

486+
### Execute
487+
488+
#### ```await sql``.execute()```
489+
490+
The lazy Promise implementation in Postgres.js is what allows it to distinguish [Nested Fragments](#building-queries) from the main outer query. This also means that queries are always executed at the earliest in the following tick. If you have a specific need to execute the query in the same tick, you can call `.execute()`
491+
486492
### Unsafe raw string queries
487493

488494
<details>

0 commit comments

Comments
 (0)