> Note for AI agents: For other pages, see [llms.txt](https://supabase.com/docs/llms.txt).

# Postgres Changes filters

Send each subscriber only the changes it needs.

Filter Postgres Changes on the server by column value, with operators for equality, ranges, lists, patterns, nulls, negation, and combined conditions.

Pass a filter in the `filter` parameter of a [Postgres Changes](https://supabase.com/docs/guides/realtime/postgres-changes#filtering-for-specific-changes) subscription.

Realtime offers filters so you can specify the data your client receives at a more granular level. A filter is a `column=operator.value` expression (for example `id=eq.1` or `title=like.%foo%`) that Realtime evaluates on the server, so filtered-out events never leave the database.

The following operators are available:

| Operator           | Matches when the column…                             | Example                   |
| ------------------ | ---------------------------------------------------- | ------------------------- |
| `eq`               | equals the value                                     | `id=eq.1`                 |
| `neq`              | does not equal the value                             | `status=neq.done`         |
| `lt` / `lte`       | is less than / less than or equal to                 | `age=lt.65`               |
| `gt` / `gte`       | is greater than / greater than or equal to           | `quantity=gte.10`         |
| `in`               | is one of a list (max 100 values)                    | `name=in.(red,blue)`      |
| `like` / `ilike`   | matches a pattern (case-sensitive / insensitive)     | `title=like.%foo%`        |
| `match` / `imatch` | matches a POSIX regex (case-sensitive / insensitive) | `slug=match.^post-`       |
| `is`               | `IS null` / `true` / `false` / `unknown`             | `deleted_at=is.null`      |
| `isdistinct`       | is distinct from the value (NULL-safe `!=`)          | `state=isdistinct.active` |

You can also [negate any operator](#negating-a-filter-not) with `not.` and [combine multiple conditions](#combining-filters-with-and) with commas (applied as an `AND`).

Note: In JavaScript you can pass a raw filter string, or build one with the type-safe `postgresChangesFilter()` helper, which handles operator names, negation, `AND` composition, and escaping for you:

```js
import { postgresChangesFilter } from '@supabase/supabase-js'

// → 'quantity=gte.10,status=eq.open'
const filter = postgresChangesFilter().gte('quantity', 10).eq('status', 'open')
```

## Equal to (`eq`)

To listen to changes when a column's value in a table equals a client-specified value:

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'messages',
      filter: postgresChangesFilter().eq('body', 'hey'),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'messages',
      filter: 'body=eq.hey',
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.update,
        schema: 'public',
        table: 'messages',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.eq,
          column: 'body',
          value: 'hey',
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  UpdateAction.self,
  schema: "public",
  table: "messages",
  filter: .eq("body", value: "hey")
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "messages"
    filter = "body=eq.hey"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "UPDATE",
  schema="public",
  table="messages",
  filter="body=eq.hey",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "messages", ListenType.Updates, "body=eq.hey"));
channel.AddPostgresChangeHandler(ListenType.Updates, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres's `=` filter.

## Not equal to (`neq`)

To listen to changes when a column's value in a table does not equal a client-specified value:

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'messages',
      filter: postgresChangesFilter().neq('body', 'bye'),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'messages',
      filter: 'body=neq.bye',
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'messages',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.neq,
          column: 'body',
          value: 'bye',
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  UpdateAction.self,
  schema: "public",
  table: "messages",
  filter: .neq("body", value: "hey")
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "messages"
    filter = "body=neq.bye"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "INSERT",
  schema="public",
  table="messages",
  filter="body=neq.bye",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "messages", ListenType.Inserts, "body=neq.bye"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres's `!=` filter.

## Less than (`lt`)

To listen to changes when a column's value in a table is less than a client-specified value:

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'profiles',
      filter: postgresChangesFilter().lt('age', 65),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'profiles',
      filter: 'age=lt.65',
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'profiles',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.lt,
          column: 'age',
          value: 65,
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "profiles",
  filter: .lt("age", value: 65)
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Insert>(schema = "public") {
    table = "profiles"
    filter = "age=lt.65"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "INSERT",
  schema="public",
  table="profiles",
  filter="age=lt.65",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "profiles", ListenType.Inserts, "age=lt.65"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres's `<` filter, so it works for non-numeric types. Make sure to check the expected behavior of the compared data's type.

## Less than or equal to (`lte`)

To listen to changes when a column's value in a table is less than or equal to a client-specified value:

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'profiles',
      filter: postgresChangesFilter().lte('age', 65),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'profiles',
      filter: 'age=lte.65',
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'profiles',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.lte,
          column: 'age',
          value: 65,
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "profiles",
  filter: .lte("age", value: 65)
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "profiles"
    filter = "age=lte.65"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "UPDATE",
  schema="public",
  table="profiles",
  filter="age=lte.65",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "profiles", ListenType.Updates, "age=lte.65"));
channel.AddPostgresChangeHandler(ListenType.Updates, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres' `<=` filter, so it works for non-numeric types. Make sure to check the expected behavior of the compared data's type.

## Greater than (`gt`)

To listen to changes when a column's value in a table is greater than a client-specified value:

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'products',
      filter: postgresChangesFilter().gt('quantity', 10),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'products',
      filter: 'quantity=gt.10',
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'products',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.gt,
          column: 'quantity',
          value: 10,
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "products",
  filter: .gt("quantity", value: 10)
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "products"
    filter = "quantity=gt.10"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "UPDATE",
  schema="public",
  table="products",
  filter="quantity=gt.10",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "products", ListenType.Inserts, "quantity=gt.10"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres's `>` filter, so it works for non-numeric types. Make sure to check the expected behavior of the compared data's type.

## Greater than or equal to (`gte`)

To listen to changes when a column's value in a table is greater than or equal to a client-specified value:

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'products',
      filter: postgresChangesFilter().gte('quantity', 10),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'products',
      filter: 'quantity=gte.10',
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'products',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.gte,
          column: 'quantity',
          value: 10,
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "products",
  filter: .gte("quantity", value: 10)
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "products"
    filter = "quantity=gte.10"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "UPDATE",
  schema="public",
  table="products",
  filter="quantity=gte.10",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "products", ListenType.Inserts, "quantity=gte.10"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres's `>=` filter, so it works for non-numeric types. Make sure to check the expected behavior of the compared data's type.

## Contained in list (in)

To listen to changes when a column's value in a table equals any client-specified values:

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'colors',
      filter: postgresChangesFilter().in('name', ['red', 'blue', 'yellow']),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'colors',
      filter: 'name=in.(red,blue,yellow)',
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'colors',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.inFilter,
          column: 'name',
          value: ['red', 'blue', 'yellow'],
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "products",
  filter: .in("name", values: ["red", "blue", "yellow"])
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "products"
    filter = "name=in.(red,blue,yellow)"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "UPDATE",
  schema="public",
  table="products",
  filter="name=in.(red,blue,yellow)",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "colors", ListenType.Inserts, "name=in.(red,blue,yellow)"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres's `= ANY`. Realtime allows a maximum of 100 values for this filter.

## Pattern matching (`like`, `ilike`)

To listen to changes when a text column matches a pattern, use `like` (case-sensitive) or `ilike` (case-insensitive). Use `%` to match any sequence of characters and `_` to match a single character.

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'articles',
      // matches "Breaking News", "BREAKING", ...
      filter: postgresChangesFilter().ilike('title', '%breaking%'),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'articles',
      filter: 'title=ilike.%breaking%', // matches "Breaking News", "BREAKING", ...
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'articles',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.ilike,
          column: 'title',
          value: '%breaking%',
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "articles",
  filter: .ilike("title", value: "%breaking%")
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Insert>(schema = "public") {
    table = "articles"
    filter = "title=ilike.%breaking%"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "INSERT",
  schema="public",
  table="articles",
  filter="title=ilike.%breaking%",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "articles", ListenType.Inserts, "title=ilike.%breaking%"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

`like` uses Postgres's `LIKE` and `ilike` uses `ILIKE`. Both require a text-compatible column. The examples above use `ilike`; swap in `like` for case-sensitive matching—usage is otherwise identical.

## Regular expression matching (`match`, `imatch`)

To listen to changes when a text column matches a POSIX regular expression, use `match` (case-sensitive) or `imatch` (case-insensitive).

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'posts',
      // matches "post-1", "post-42", ...
      filter: postgresChangesFilter().match('slug', '^post-\\d+$'),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'posts',
      filter: 'slug=match.^post-\\d+$', // matches "post-1", "post-42", ...
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'posts',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.match,
          column: 'slug',
          value: r'^post-\d+$',
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "posts",
  filter: .match("slug", value: "^post-\\d+$")
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Insert>(schema = "public") {
    table = "posts"
    filter = "slug=match.^post-\\d+$"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "INSERT",
  schema="public",
  table="posts",
  filter="slug=match.^post-\\d+$",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "posts", ListenType.Inserts, @"slug=match.^post-\d+$"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

`match` uses Postgres's `~` operator and `imatch` uses `~*`. Both require a text-compatible column, and the pattern is validated when you subscribe. The examples above use `match`; swap in `imatch` for case-insensitive matching—usage is otherwise identical.

## Null and boolean checks (`is`)

To listen to changes when a column `IS` `null`, `true`, `false`, or `unknown`, use `is`. `is.null` works on any column type; `is.true`, `is.false`, and `is.unknown` require a boolean column.

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'todos',
      // only rows that are not yet completed
      filter: postgresChangesFilter().is('completed_at', null),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'todos',
      filter: 'completed_at=is.null', // only rows that are not yet completed
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.update,
        schema: 'public',
        table: 'todos',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.isFilter,
          column: 'completed_at',
          value: null,
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  UpdateAction.self,
  schema: "public",
  table: "todos",
  filter: .is("completed_at", value: .null)
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "todos"
    filter = "completed_at=is.null"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "UPDATE",
  schema="public",
  table="todos",
  filter="completed_at=is.null",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "todos", ListenType.Updates, "completed_at=is.null"));
channel.AddPostgresChangeHandler(ListenType.Updates, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

This filter uses Postgres's `IS` operator.

## Distinct from (`isdistinct`)

`isdistinct` is a NULL-safe inequality (`IS DISTINCT FROM`). Unlike `neq`, it treats `null` as a comparable value, so a `null` column is considered distinct from a non-null value.

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'orders',
      // includes rows where status is null
      filter: postgresChangesFilter().isDistinct('status', 'shipped'),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'UPDATE',
      schema: 'public',
      table: 'orders',
      filter: 'status=isdistinct.shipped', // includes rows where status is null
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.update,
        schema: 'public',
        table: 'orders',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.isDistinct,
          column: 'status',
          value: 'shipped',
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  UpdateAction.self,
  schema: "public",
  table: "orders",
  filter: .isDistinct("status", value: "shipped")
)

await myChannel.subscribe()

for await change in changes {
  print(change.record)
}
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
    table = "orders"
    filter = "status=isdistinct.shipped"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "UPDATE",
  schema="public",
  table="orders",
  filter="status=isdistinct.shipped",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "orders", ListenType.Updates, "status=isdistinct.shipped"));
channel.AddPostgresChangeHandler(ListenType.Updates, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

## Negating a filter (`not`)

Prefix any operator with `not.` to invert it — for example `not.in`, `not.is`, or `not.like`.

**JavaScript**

**Builder**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: '*',
      schema: 'public',
      table: 'posts',
      // anything except drafts and archived
      filter: postgresChangesFilter().not('status', 'in', ['draft', 'archived']),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: '*',
      schema: 'public',
      table: 'posts',
      filter: 'status=not.in.(draft,archived)', // anything except drafts and archived
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

Set `negate: true` on a `PostgresChangeFilter` to apply the `not.` prefix.

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.all,
        schema: 'public',
        table: 'posts',
        filter: PostgresChangeFilter(
          type: PostgresChangeFilterType.inFilter,
          column: 'status',
          value: ['draft', 'archived'],
          negate: true,
        ),
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

Wrap any single-condition filter in `.not(...)`.

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  AnyAction.self,
  schema: "public",
  table: "posts",
  filter: .not(.in("status", values: ["draft", "archived"]))
)

await myChannel.subscribe()
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction>(schema = "public") {
    table = "posts"
    filter = "status=not.in.(draft,archived)"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "*",
  schema="public",
  table="posts",
  filter="status=not.in.(draft,archived)",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "posts", ListenType.All, "status=not.in.(draft,archived)"));
channel.AddPostgresChangeHandler(ListenType.All, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

## Combining filters with `AND`

Combine multiple conditions by separating them with commas. All conditions must match (logical `AND`). You can only combine conditions with `AND` — `OR` is not supported.

**JavaScript**

**Builder**

The builder composes conditions and escapes reserved characters for you.

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'orders',
      // amount > 100 AND status = "open"
      filter: postgresChangesFilter().gt('amount', 100).eq('status', 'open'),
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Filter string**

```js
const channel = supabase
  .channel('changes')
  .on(
    'postgres_changes',
    {
      event: 'INSERT',
      schema: 'public',
      table: 'orders',
      filter: 'amount=gt.100,status=eq.open', // amount > 100 AND status = "open"
    },
    (payload) => console.log(payload)
  )
  .subscribe()
```

**Dart**

Pass a list of filters to `filters` to combine them with `AND`.

```dart
supabase
    .channel('changes')
    .onPostgresChanges(
        event: PostgresChangeEvent.insert,
        schema: 'public',
        table: 'orders',
        filters: [
          PostgresChangeFilter(
            type: PostgresChangeFilterType.gt,
            column: 'amount',
            value: 100,
          ),
          PostgresChangeFilter(
            type: PostgresChangeFilterType.eq,
            column: 'status',
            value: 'open',
          ),
        ],
        callback: (payload) => print(payload))
    .subscribe();
```

**Swift**

Use `.and([...])` to combine multiple conditions.

```swift
let myChannel = await supabase.channel("db-changes")

let changes = await myChannel.postgresChange(
  InsertAction.self,
  schema: "public",
  table: "orders",
  filter: .and([
    .gt("amount", value: 100),
    .eq("status", value: "open"),
  ])
)

await myChannel.subscribe()
```

**Kotlin**

```kotlin
val myChannel = supabase.channel("db-changes")

val changes = myChannel.postgresChangeFlow<PostgresAction.Insert>(schema = "public") {
    table = "orders"
    filter = "amount=gt.100,status=eq.open"
}

changes
    .onEach {
        println(it.record)
    }
    .launchIn(yourCoroutineScope)

myChannel.subscribe()
```

**Python**

```python
changes = supabase.channel('db-changes').on_postgres_changes(
  "INSERT",
  schema="public",
  table="orders",
  filter="amount=gt.100,status=eq.open",
  callback=lambda payload: print(payload)
).subscribe()
```

**C#**

```c#
var channel = supabase.Realtime.Channel("changes");

channel.Register(new PostgresChangesOptions("public", "orders", ListenType.Inserts, "amount=gt.100,status=eq.open"));
channel.AddPostgresChangeHandler(ListenType.Inserts, (sender, change) =>
{
    Console.WriteLine(change.Payload);
});

await channel.Subscribe();
```

Note: Values that contain reserved characters (`,`, `(`, `)`, `"`, or `\`) must be double-quoted PostgREST-style so the server doesn't read them as condition or list boundaries — for example `name=eq."Doe, Jane"`. The `postgresChangesFilter()` builder (JavaScript), `PostgresChangeFilter` (Dart), and `RealtimePostgresFilter` (Swift) apply this quoting for you.

## Next steps

To keep going, use these pages:

- [Filter changes](https://supabase.com/docs/guides/realtime/postgres-changes#filtering-for-specific-changes): add a filter to a Postgres Changes subscription.
- [Select specific columns](https://supabase.com/docs/guides/realtime/postgres-changes#select-specific-columns): send each event with only the columns your client uses.
- [Scaling Postgres Changes](https://supabase.com/docs/guides/realtime/postgres-changes#scaling-postgres-changes): keep throughput up as the number of subscribers grows.
