# bitstring_agg — DuckDB 2.0.0

Returns a bitstring with bits set for each distinct value.

- Reference: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/
- JSON: /products/haybarn/functions/api/v1/duckdb-2.0.0/functions/bitstring_agg.json
- Snapshot ID: duckdb-2.0.0
- Engine: duckdb v2.0.0
- Source ID: d54cbbe3df
- Binary SHA-256: 4d5d001f4b0a16c16f1bc83338153a70bec7e58f0cae0eec4b44b9b9afa0bef0
- Captured: 2026-11-06T18:35:28.343Z
- Source: https://github.com/duckdb/duckdb/releases/tag/v2.0.0
- Loaded extensions: autocomplete, core_functions, icu, json, parquet, shell

## Interpretation

- Choose a snapshot matching the target engine and build. The default is captured from the published Haybarn WASM package used by the browser playground. Historical native snapshots are also available.
- Availability is an observation in the recorded build and extension profile, not a guarantee of support in every installation or in WASM.
- Types and descriptions are declarations from duckdb_functions(). Binding can specialize result types. Null means not supplied by the catalog; do not invent defaults, optionality, argument mode, or table output columns.
- Raw parameter arrays preserve catalog order for scalar/aggregate/macro functions. Raw table arguments are alphabetical. Use callingConvention for engine-confirmed positional order and named arguments; null modes are unrecorded. Named does not mean optional. Macro defaults and special named variadic behavior are not supplied by duckdb_functions().
- Catalog examples are source material and may require data or extensions. runnableExamples contains separately verified SQL for the pinned WASM package; sample-data adaptations and guide examples are labeled separately.
- Guide annotations and recipes are separate editorial content. The browser runner always uses Haybarn WASM 2.0.0-rc12, independently of the documentation snapshot.
- All URLs beginning with / are relative to the origin hosting this document. Exports require no JavaScript, cookies, API key, or browser engine.

## Overloads

### overload-59074a251554bd3c

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: BIGINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-59074a251554bd3c

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | BIGINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-4efd02fd0bb3f132

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: HUGEINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-4efd02fd0bb3f132

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | HUGEINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-04daed0086f80c6e

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: INTEGER) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-04daed0086f80c6e

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | INTEGER | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-06f2e993a10d8aa7

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: SMALLINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-06f2e993a10d8aa7

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | SMALLINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-b223357a76d96ac7

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: TINYINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-b223357a76d96ac7

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | TINYINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-25fad99f88e1797a

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UBIGINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-25fad99f88e1797a

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UBIGINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-f5f36039c34f93e7

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UHUGEINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-f5f36039c34f93e7

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UHUGEINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-4788b6c0c044860c

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UINTEGER) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-4788b6c0c044860c

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UINTEGER | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-5ba313a7af822946

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: USMALLINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-5ba313a7af822946

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | USMALLINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-ea395c90ad3c7db5

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UTINYINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-ea395c90ad3c7db5

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UTINYINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-c2546db142d5da23

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: BIGINT, min: BIGINT, max: BIGINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-c2546db142d5da23

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | BIGINT | not recorded |
| min | BIGINT | not recorded |
| max | BIGINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-335153207d02f102

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: HUGEINT, min: HUGEINT, max: HUGEINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-335153207d02f102

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | HUGEINT | not recorded |
| min | HUGEINT | not recorded |
| max | HUGEINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-63225f6760a63304

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: INTEGER, min: INTEGER, max: INTEGER) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-63225f6760a63304

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | INTEGER | not recorded |
| min | INTEGER | not recorded |
| max | INTEGER | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-3b8bb153e04c80db

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: SMALLINT, min: SMALLINT, max: SMALLINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-3b8bb153e04c80db

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | SMALLINT | not recorded |
| min | SMALLINT | not recorded |
| max | SMALLINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-6fda02052d8b95c5

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: TINYINT, min: TINYINT, max: TINYINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-6fda02052d8b95c5

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | TINYINT | not recorded |
| min | TINYINT | not recorded |
| max | TINYINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-96ac7cd078cdd900

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UBIGINT, min: UBIGINT, max: UBIGINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-96ac7cd078cdd900

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UBIGINT | not recorded |
| min | UBIGINT | not recorded |
| max | UBIGINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-5c200317b45e2785

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UHUGEINT, min: UHUGEINT, max: UHUGEINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-5c200317b45e2785

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UHUGEINT | not recorded |
| min | UHUGEINT | not recorded |
| max | UHUGEINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-9ae18e7bb19db964

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UINTEGER, min: UINTEGER, max: UINTEGER) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-9ae18e7bb19db964

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UINTEGER | not recorded |
| min | UINTEGER | not recorded |
| max | UINTEGER | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-dcb4e627b318e560

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: USMALLINT, min: USMALLINT, max: USMALLINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-dcb4e627b318e560

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | USMALLINT | not recorded |
| min | USMALLINT | not recorded |
| max | USMALLINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-f4959d31a87a1bb2

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UTINYINT, min: UTINYINT, max: UTINYINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-2.0.0/bitstring_agg/#overload-f4959d31a87a1bb2

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UTINYINT | not recorded |
| min | UTINYINT | not recorded |
| max | UTINYINT | not recorded |

Declared return type: BIT. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.


## Guide recipes

No guide recipes.

## Engine catalog examples

Source examples may require additional data or extensions. Expressions are wrapped in SELECT; execution verification is not recorded.

Reported for: overload-59074a251554bd3c, overload-4efd02fd0bb3f132, overload-04daed0086f80c6e, overload-06f2e993a10d8aa7, overload-b223357a76d96ac7, overload-25fad99f88e1797a, overload-f5f36039c34f93e7, overload-4788b6c0c044860c, overload-5ba313a7af822946, overload-ea395c90ad3c7db5, overload-c2546db142d5da23, overload-335153207d02f102, overload-63225f6760a63304, overload-3b8bb153e04c80db, overload-6fda02052d8b95c5, overload-96ac7cd078cdd900, overload-5c200317b45e2785, overload-9ae18e7bb19db964, overload-dcb4e627b318e560, overload-f4959d31a87a1bb2

```sql
SELECT bitstring_agg(A);
```

## Runnable examples

Executed successfully in Haybarn WASM 2.0.0-rc12. Sample data and guide examples are separate from the original catalog.

```sql
SELECT bitstring_agg(value, 1, 5) AS present
FROM (VALUES (1), (3), (5)) AS data(value);
```

## Additional DuckDB documentation

- [Aggregate Functions](https://duckdb.org/docs/current/sql/functions/aggregates#bitstring_aggarg)
- [Bitstring Functions](https://duckdb.org/docs/current/sql/functions/bitstring#bitstring_aggarg-min-max)

## Observed availability

| Snapshot | Observed | Overloads | JSON |
| --- | --- | --- | --- |
| haybarn-2.0.0-rc12 | present | 20 | [reference](/products/haybarn/functions/api/v1/haybarn-2.0.0-rc12/functions/bitstring_agg.json) |
| haybarn-2.0.0-rc11 | present | 20 | [reference](/products/haybarn/functions/api/v1/haybarn-2.0.0-rc11/functions/bitstring_agg.json) |
| haybarn-2.0.0-rc8 | present | 20 | [reference](/products/haybarn/functions/api/v1/haybarn-2.0.0-rc8/functions/bitstring_agg.json) |
| haybarn-1.5.5-rc3 | present | 20 | [reference](/products/haybarn/functions/api/v1/haybarn-1.5.5-rc3/functions/bitstring_agg.json) |
| haybarn-1.5.6-rc6 | present | 20 | [reference](/products/haybarn/functions/api/v1/haybarn-1.5.6-rc6/functions/bitstring_agg.json) |
| duckdb-2.0.0 | present | 20 | [reference](/products/haybarn/functions/api/v1/duckdb-2.0.0/functions/bitstring_agg.json) |
| duckdb-1.5.6 | present | 20 | [reference](/products/haybarn/functions/api/v1/duckdb-1.5.6/functions/bitstring_agg.json) |
| duckdb-1.5.5 | present | 20 | [reference](/products/haybarn/functions/api/v1/duckdb-1.5.5/functions/bitstring_agg.json) |
| duckdb-1.4.4 | present | 20 | [reference](/products/haybarn/functions/api/v1/duckdb-1.4.4/functions/bitstring_agg.json) |
| duckdb-1.3.2 | present | 20 | [reference](/products/haybarn/functions/api/v1/duckdb-1.3.2/functions/bitstring_agg.json) |

Engine catalog documentation is derived from MIT-licensed Haybarn and DuckDB. [Notices](/third-party-notices.txt).
