Lists & arrays
Scalar
list_extract()
Extract the indexth (1-based) value from the list.
Reference: Haybarn WASM 2.0.0-rc12
Arguments & returns
2 overloadslist_extract(list, index)
Scalar
| Overload link | list | index |
Returns |
|---|---|---|---|
| #01 | T[] | BIGINT |
T |
list_extract(string, index)
Scalar
| Overload link | string | index |
Returns |
|---|---|---|---|
| #02 | VARCHAR | BIGINT |
VARCHAR |
Get an item by list position
Read one item from a SQL list using a one-based position. Negative positions count backward from the end.
An out-of-range position returns NULL. The last item is at position -1.
Haybarn WASM 2.0.0-rc12 · In your browser
Guide example · Run to view results.
| first_item | last_item | outside |
|---|---|---|
apple | pear | NULL |
Watch for: SQL lists start at 1, while JSON array paths start at 0. Adjust positions when moving between the two representations.
Example
Haybarn WASM 2.0.0-rc12 · In your browser
Engine example · Run to view results.