Skip to content

Fix compiler error when using table-valued output multiple times#548

Merged
simolus3 merged 1 commit intomainfrom
fix-546
Mar 6, 2026
Merged

Fix compiler error when using table-valued output multiple times#548
simolus3 merged 1 commit intomainfrom
fix-546

Conversation

@simolus3
Copy link
Contributor

@simolus3 simolus3 commented Mar 5, 2026

For a filter expression like FROM json_each(auth.parameter('workspaces')) WHERE value ->> 'role' = 'user' AND value ->> 'type' = 'individual', the filter simplifier attempts to merge the two expressions from the AND node into a single expression since they both depend on no tables. Due to a bug in BaseSourceResultSet.areCompatible, this then crashed the compiler because two identical TableValuedResultSets aren't considered to be compatible.

The implementation of canAttachTo is correct, but it shouldn't be the only thing determining compatibility. Checking equality before anything else fixes the issue, I've attached the query as a regression test (I've manually verified the compiled sync plan).

Closes #546.

@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: 87aea00

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@powersync/service-sync-rules Patch
@powersync/service-jpgwire Patch
@powersync/service-core-tests Patch
@powersync/service-core Patch
@powersync/lib-services-framework Patch
@powersync/service-module-mongodb-storage Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-mssql Patch
@powersync/service-module-mysql Patch
@powersync/service-module-postgres-storage Patch
@powersync/service-module-postgres Patch
@powersync/lib-service-postgres Patch
@powersync/service-module-core Patch
@powersync/service-image Patch
test-client Patch
@powersync/service-rsocket-router Patch
@powersync/lib-service-mongodb Patch
@powersync/service-schema Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simolus3 simolus3 requested a review from rkistner March 5, 2026 19:14
@simolus3 simolus3 merged commit b410924 into main Mar 6, 2026
31 checks passed
@simolus3 simolus3 deleted the fix-546 branch March 6, 2026 08:16
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.

Expression with multiple dependencies passed to SingleDependencyExpression

2 participants