citusdata / citusdata/citus

Trigger example on docs doesn't work

Open
#1,568 2 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

Not sure where to open this issue, but the reason is a regression on Citus, so opening here.

`shard_name()` now returns quoted schema-qualified identifier instead of just the table name. This breaks our trigger example on docs.
https://docs.citusdata.com/en/v6.2/extra/query_propagation.html#running-on-all-placements

Query

```sql
SELECT run_command_on_placements('big_vals', $cmd$
CREATE OR REPLACE FUNCTION embiggen_%1$I() RETURNS TRIGGER AS $$
BEGIN
IF (TG_OP = 'INSERT') THEN
INSERT INTO %1$I (key, val) VALUES (NEW.key, NEW.val*2);
END IF;

RETURN NULL;
END;
$$ LANGUAGE plpgsql;
$cmd$);
```

Worker node error;
```sql
ERROR: syntax error at or near ""public.big_vals_102070"" at character 40
STATEMENT:
CREATE OR REPLACE FUNCTION embiggen_"public.big_vals_102070"() RETURNS TRIGGER AS $$
BEGIN
IF (TG_OP = 'INSERT') THEN
INSERT INTO "public.big_vals_102070" (key, val) VALUES (NEW.key, NEW.val*2);
END IF;

RETURN NULL;
END;
$$ LANGUAGE plpgsql;
```

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.