cockroachdb / cockroachdb/cockroach
Multiple tables in CDC expressions
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
For "old style" changefeeds, we have the flexibility to include multiple tables:
```root@localhost:26257/defaultdb> CREATE CHANGEFEED FOR TABLE a, b WITH schema_change_policy='stop';
{"key":"[822988914618007553]","table":"a","value":"{\"after\": {\"id\": 1, \"rowid\": 822988914618007553}}"}
{"key":"[822988936953397249]","table":"b","value":"{\"after\": {\"id\": 1, \"rowid\": 822988936953397249}}"}
```
At least when it wouldn't lead to pathological cases, it would be nice to be allowed to reference multiple tables in CDC expressions, as well.
```root@localhost:26257/defaultdb> CREATE CHANGEFEED WITH schema_change_policy='stop' AS SELECT *, id as ciao FROM a JOIN b ON a.id = b.id;
invalid syntax: statement ignored: at or near "join": syntax error
SQLSTATE: 42601
DETAIL: source SQL:
CREATE CHANGEFEED WITH schema_change_policy='stop' AS SELECT *, id as ciao FROM a JOIN b ON a.id = b.id
^
root@localhost:26257/defaultdb>
```
Jira issue: CRDB-22541
Epic CRDB-21713
Contributor guide
Research direction
Start from the CREATE CHANGEFEED CDC expression syntax shown in the issue and trace how the current single-table source is parsed and validated. Define what support for multiple tables and JOIN expressions should allow, then add coverage for the demonstrated query and confirm existing old-style multi-table changefeeds remain unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100