#6385·paradedb

string_agg(..., NULL) uses a comma in DataFusion AggregateScan

Author: robertmuCreated Sep 17, 2026Updated Sep 17, 2026
Labelsbug

What happens?

PostgreSQL and DataFusion both concatenate non-NULL values without a separator when the STRING_AGG delimiter is a NULL literal.

ParadeDB's DataFusion AggregateScan instead replaces the NULL delimiterwith a comma. For two tech values, it returns tech,tech instead oftechtech. Disabling paradedb.enable_aggregate_custom_scan returns the expected techtech.

To Reproduce

sql
CREATE TABLE string_agg_products (
    id integer PRIMARY KEY,
    description text NOT NULL
);

CREATE TABLE string_agg_tags (
    id integer PRIMARY KEY,
    product_id integer NOT NULL,
    tag_name text NOT NULL
);

INSERT INTO string_agg_products
VALUES (1, 'Laptop with fast processor');

INSERT INTO string_agg_tags
VALUES (1, 1, 'tech'), (2, 1, 'tech');

CREATE INDEX string_agg_products_idx
ON string_agg_products USING paradedb (id, description);

CREATE INDEX string_agg_tags_idx
ON string_agg_tags USING paradedb (id, product_id, tag_name)
WITH (
    text_fields = '{"tag_name":{"fast":true}}'
);

SET paradedb.enable_aggregate_custom_scan = off;

SELECT string_agg(t.tag_name, NULL)
FROM string_agg_products p
JOIN string_agg_tags t ON p.id = t.product_id
WHERE p.description @@@ 'laptop';
-- techtech

SET paradedb.enable_aggregate_custom_scan = on;

EXPLAIN (COSTS OFF)
SELECT string_agg(t.tag_name, NULL)
FROM string_agg_products p
JOIN string_agg_tags t ON p.id = t.product_id
WHERE p.description @@@ 'laptop';

SELECT string_agg(t.tag_name, NULL)
FROM string_agg_products p
JOIN string_agg_tags t ON p.id = t.product_id
WHERE p.description @@@ 'laptop';
-- tech,tech

OS:

macOS 26.4.1 (arm64, build 25E253)

ParadeDB Version (e.g. output of SELECT * FROM paradedb.version_info();):

ParadeDB: 0.25.6 PostgreSQL:PostgreSQL 18.6 on aarch64-apple-darwin25.4.0, compiled by Apple clang version 21.0.0 (clang-2100.1.1.101), 64-bit

Are you using ParadeDB Docker, Helm, or the extension(s) standalone?

ParadeDB pg_search Extension

Full Name:

Robert Mu

Affiliation:

Unaffiliated

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include the code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configurations (e.g., CPU architecture, PostgreSQL version, Linux distribution) to reproduce the issue?

  • Yes, I have