long2ice/meilisync

Postgres source ignores changes

MattExact opened this issue · 1 comments

The following lines are used to determine whether to add a change to the queue.
Instead of return when the table is not in self.tables, it should be continue.
Otherwise if the first change's table is not in the list of tables, it will ignore all other changes.

for change in changes:
kind = change.get("kind")
table = change.get("table")
if table not in self.tables:
return

For example if self.tables = ["bar"], then the following replication message would be ignored:

changes = [
    {
        "kind": "update",
        "schema": "public",
        "table": "foo",
        "columnnames": ["id", "attributes"],
        "columntypes": ["integer", "hstore"],
        "columnvalues": [123456, '"foo"=>"bar"'],
        "oldkeys": {"keynames": ["id"], "keytypes": ["integer"], "keyvalues": [123456]},
    },
    {
        "kind": "update",
        "schema": "public",
        "table": "bar",
        "columnnames": ["id", "content"],
        "columntypes": ["integer", "text"],
        "columnvalues": [456789, "Lorem ipsum"],
        "oldkeys": {"keynames": ["id"], "keytypes": ["integer"], "keyvalues": [456789]},
    },
]

Thanks for report! Could you please make a PR?