cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.97k stars 3.79k forks source link

Multiple tables in CDC expressions #93822

Open ale-dd opened 1 year ago

ale-dd commented 1 year ago

For "old style" changefeeds, we have the flexibility to include multiple tables:

{"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.

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

blathers-crl[bot] commented 1 year ago

Hello, I am Blathers. I am here to help you get the issue triaged.

It looks like you have not filled out the issue in the format of any of our templates. To best assist you, we advise you to use one of these templates.

I have CC'd a few people who may be able to assist you:

If we have not gotten back to your issue within a few business days, you can try the following:

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

blathers-crl[bot] commented 1 year ago

cc @cockroachdb/cdc

miretskiy commented 1 year ago

Thank you for filing this issue. Joins are not supported with cdc expressions. You can use "old" style changefeeds that allow you to specify multiple tables. But if you want to use "new" style changefeed, you have to restrict your feed to a single table.

Support for streaming joins is non-trivial, and will take a while before (or even if) this feature is supported.

blathers-crl[bot] commented 1 year ago

cc @cockroachdb/cdc

amruss commented 1 year ago

Hey @ale-dd I'm going to leave this on the backlog, but be aware we aren't planning on picking this up anytime soon