citusdata / citusdata/citus

EXPLAIN ANALYZE fails for distributed custom aggregates with 'ERROR: column "field_0" has pseudo-type cstring'

Open
#4,043 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

sum2 is a user-defined aggregate whose execution can be pushed down to worker nodes. Regular execution succeeds, but EXPLAIN ANALYZE fails:
```sql
explain analyze select sum2(val1) from inttbl;
ERROR: column "field_0" has pseudo-type cstring
CONTEXT: while executing command on localhost:9702
```
Corresponding plan:
```sql
explain verbose select sum2(val1) from inttbl;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=250.00..250.01 rows=1 width=4)
Output: coord_combine_agg('25135'::oid, remote_scan.sum2, NULL::integer)
-> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=100000 width=32)
Output: remote_scan.sum2
Task Count: 32
Tasks Shown: One of 32
-> Task
Query: SELECT worker_partial_agg('public.sum2(integer)'::regprocedure, val1) AS sum2 FROM inttbl_102168 inttbl WHERE true
Node: host=localhost port=9701 dbname=postgres
-> Aggregate (cost=35.50..35.51 rows=1 width=32)
Output: worker_partial_agg('25139'::oid, val1)
-> Seq Scan on public.inttbl_102168 inttbl (cost=0.00..30.40 rows=2040 width=4)
Output: id, val1, val2
(13 rows)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.