citusdata / citusdata/citus

run_command_on_colocated_placements does not work on reference tables

Open
#2,913 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

```sql
-- Repro code
CREATE TABLE reference_a (
id int PRIMARY KEY,
val int
);
CREATE TABLE reference_b (
id int PRIMARY KEY,
val int
);
SELECT create_reference_table('reference_a');
SELECT create_reference_table('reference_b');
INSERT INTO reference_a (id, val) VALUES (1, 1);
INSERT INTO reference_b (id, val) VALUES (1, 2);

SELECT run_command_on_colocated_placements(
'reference_a',
'reference_b',
$cmd$SELECT a.val + b.val combined FROM reference_a a join reference_b b on a.id = b.id$cmd$
);
```
The code seems to expect distributed tables only. Is there a way to do something similar with reference tables?

I am trying to create a reference table which has an audit trigger to put a copy in a reference history table.

Thanks, John

Contributor guide

Open the contributing guide

Research direction

Start by running the SQL reproduction using run_command_on_colocated_placements with reference_a and reference_b. Read the behavior around reference tables and the function's handling of distributed tables, then determine whether equivalent execution or a documented limitation is expected. Done means the reference-table audit/history use case has a clear supported outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.