# bitstring_agg — DuckDB 1.5.5

Returns a bitstring with bits set for each distinct value.

- Reference: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/
- JSON: /products/haybarn/functions/api/v1/duckdb-1.5.5/functions/bitstring_agg.json
- Snapshot ID: duckdb-1.5.5
- Engine: duckdb v1.5.5
- Source ID: d8cdaa33fd
- Binary SHA-256: 8463eb26527b278109cfddffc4606e1019ebefcfe2eac75efc53c76ed8f282d5
- Captured: 2026-09-05T18:37:40.699Z
- Source: https://github.com/duckdb/duckdb/releases/tag/v1.5.5
- 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 1.5.5-rc3, 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-1.5.5/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-1.5.5/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-1.5.5/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-1.5.5/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-1.5.5/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-1.5.5/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-1.5.5/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-1.5.5/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-1.5.5/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-1.5.5/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-ca634a7df54e6908

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: BIGINT, col1: BIGINT, col2: BIGINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-ca634a7df54e6908

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

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

### overload-4281973fe8704386

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: HUGEINT, col1: HUGEINT, col2: HUGEINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-4281973fe8704386

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

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

### overload-6f20c1003df6baad

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: INTEGER, col1: INTEGER, col2: INTEGER) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-6f20c1003df6baad

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

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

### overload-1c7e6bb5b5551ab1

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: SMALLINT, col1: SMALLINT, col2: SMALLINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-1c7e6bb5b5551ab1

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

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

### overload-2e6e148ca92a380e

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: TINYINT, col1: TINYINT, col2: TINYINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-2e6e148ca92a380e

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

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

### overload-4f00a755bdc737c9

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UBIGINT, col1: UBIGINT, col2: UBIGINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-4f00a755bdc737c9

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

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

### overload-28826d6338f76374

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UHUGEINT, col1: UHUGEINT, col2: UHUGEINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-28826d6338f76374

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

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

### overload-43efd674b60ed537

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UINTEGER, col1: UINTEGER, col2: UINTEGER) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-43efd674b60ed537

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

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

### overload-020113c5d628ec9c

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: USMALLINT, col1: USMALLINT, col2: USMALLINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-020113c5d628ec9c

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

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

### overload-cd1680584ec74467

Kind: aggregate. Parameter order: catalog-order.

```text
bitstring_agg(arg: UTINYINT, col1: UTINYINT, col2: UTINYINT) → BIT
```

Link: /products/haybarn/functions/releases/duckdb-1.5.5/bitstring_agg/#overload-cd1680584ec74467

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| arg | UTINYINT | not recorded |
| col1 | UTINYINT | not recorded |
| col2 | 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-ca634a7df54e6908, overload-4281973fe8704386, overload-6f20c1003df6baad, overload-1c7e6bb5b5551ab1, overload-2e6e148ca92a380e, overload-4f00a755bdc737c9, overload-28826d6338f76374, overload-43efd674b60ed537, overload-020113c5d628ec9c, overload-cd1680584ec74467

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

## Runnable examples

Executed successfully in Haybarn WASM 1.5.5-rc3. 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-1.5.5-rc3 | present | 20 | [reference](/products/haybarn/functions/api/v1/haybarn-1.5.5-rc3/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).
