apache / apache/cloudberry

[Bug] ERROR: unexpected argument locus to set operation (cdbsetop.c:178)

Open
#1,240 0 comments 0 reactions 0 assignees View on GitHub
type: Bug
Dominant language
C
Stars
1.4k
Forks
247
Avg merge
4d 3h
Merged PRs (30d)
39

Description

### Apache Cloudberry version

main

### What happened

ERROR: unexpected argument locus to set operation (cdbsetop.c:178)

### What you think should happen instead

_No response_

### How to reproduce

```sql
create table rt(a int) distributed replicated;
insert into rt select generate_series(1,10);
create table p1(a int) distributed by (a);
insert into p1 select generate_series(1,3);
CREATE TABLE
INSERT 0 10
CREATE TABLE
INSERT 0 3

explain(costs off) with result as (update rt set a = a +1 where a < 5 returning *) select * from result except select * from p1;
ERROR: unexpected argument locus to set operation (cdbsetop.c:178)
show optimizer;
optimizer
-----------
on
(1 row)

set optimizer=off;
SET

explain(costs off) with result as (update rt set a = a +1 where a < 5 returning *) select * from result except select * from p1;
ERROR: unexpected argument locus to set operation (cdbsetop.c:178)
```

### Operating System

All

### Anything else

_No response_

### Are you willing to submit PR?

- [x] Yes, I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/cloudberry/blob/main/CODE_OF_CONDUCT.md).

Contributor guide

Open the contributing guide

Research direction

Reproduce the supplied SQL sequence and inspect the set-operation handling at cdbsetop.c:178, comparing behavior with the optimizer both on and off. Done means the EXPLAIN query no longer fails with the unexpected argument locus error; the issue does not identify a regression test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, sql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.