Skip to content

Document multi-column join conditions in Sync Streams#395

Open
mintlify[bot] wants to merge 3 commits intomainfrom
mintlify/multi-column-joins-1776464036
Open

Document multi-column join conditions in Sync Streams#395
mintlify[bot] wants to merge 3 commits intomainfrom
mintlify/multi-column-joins-1776464036

Conversation

@mintlify
Copy link
Copy Markdown
Contributor

@mintlify mintlify Bot commented Apr 17, 2026

Summary

The Sync Streams compiler now supports queries that join two tables on multiple columns (composite keys) — previously, these queries would fail with an internal circular reference error.

  • Added a "Multi-column join conditions" subsection to the Writing Queries page with examples of composite-key joins and multi-table chain joins
  • Added a valid composite-key example to the JOIN Syntax reference in Supported SQL

Triggered by

powersync-ja/powersync-service@824e229 — Support circular references in Sync Streams

Copy link
Copy Markdown
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this change is not worth documenting, it fixes an oversight to enable queries that should always have worked.

Comment thread sync/supported-sql.mdx Outdated
SELECT comments.* FROM comments INNER JOIN issues ON comments.issue_id = issues.id

-- Valid: multiple equality conditions between tables (composite keys)
SELECT a.* FROM a, b WHERE a.region = b.region AND a.item_id = b.item_id AND b.user_id = auth.user_id()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can find a better example for composite keys though, that might be a good thing to include here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @simolus3 - check below, I added what's hopefully a better example of composite keys

Copy link
Copy Markdown
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting that the changes haven't been released yet, so we might want to wait for that first. But LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants