Skip to content

Filter on an array column breaks postgres_changes for the whole project #2361

Description

@mandar1045

Subscribing with a filter on an array column, e.g. tags=is.null on a text[] column, works fine (SUBSCRIBED). But as soon as a row changes in that table, list_changes errors out:

ERROR: malformed array literal: "["a"]"

The whole batch gets dropped, so every other subscriber in the project misses those changes too, even unfiltered ones on other tables.

The cause is in is_visible_through_filters: it compares col.value #>> '{}', which is the jsonb text (["a"]), not the Postgres literal ({a}). The same happens with composite types and jsonb columns holding a string.

Quick repro:

create table items (id int primary key, tags text[]);
-- subscribe to items with filter tags=is.null, and to any other table without a filter
insert into items values (1, '{a}');
-- the other subscriber never gets its next change

#2099 and #2175 don't catch this.

No activity

Activity on this issue will appear here.

Activity

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

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