Skip to content

Watch not working with IN and ANY Query. #258

Open
@tejas-codiste

Description

@tejas-codiste

I am using PowerSync in my Flutter app, and I need to listen for real-time updates in my local database. However, db.watch is not triggering updates when changes occur in the synced tables.

Code Implementation
This is how I'm using db.watch in my app:

var stream = db.watch(
        'SELECT * FROM events WHERE creator_user = ${FFAppState().user.userId} OR ${FFAppState().user.userId} = ANY(manager_ids) ORDER BY start_date ASC');
    eventsSubscription = stream.listen((data) {
      callback(data.map((json) => EventsRow(Map<String, dynamic>.from(json))).toList());
    });

The query works as expected in the PowerSync console but does not work inside the Flutter app.

Even when testing via the PowerSync diagnostics platform, the query does not return results.

There issue in IN and ANY Query.

Screenshots
The following screenshots illustrate the issue:

Image

Image

Image

Image

I have verified that the table is updating correctly by running sync rules.

No errors or exceptions appear in the logs related to db.watch.

Manually querying the database reflects expected changes, but the listener does not trigger.

Would appreciate any guidance on resolving this issue. Thanks in advance! 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions