> ## Documentation Index
> Fetch the complete documentation index at: https://docs.powersync.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Partitioned Tables (Postgres) with Sync Rules

> Sync data from Postgres partitioned tables in legacy Sync Rules using wildcard table name matching.

<Info>
  Sync Rules are deprecated. For the Sync Streams version of this page, see [Partitioned Tables (Postgres)](/sync/advanced/partitioned-tables).
</Info>

For partitioned tables in Postgres, each individual partition is replicated and processed using [Sync Rules](/sync/rules/overview).

To use the same queries and same output table name for each partition, use `%` for wildcard suffix matching of the table name:

```yaml theme={null}
bucket_definitions:
  by_user:
    # Use wildcard in a parameter query
    parameters: SELECT id AS user_id FROM "users_%"
    data:
      # Use wildcard in a data query
      - SELECT * FROM "todos_%" AS todos WHERE user_id = bucket.user_id
```

The wildcard character can only be used as the last character in the table name. To match tables across multiple schemas instead, see [Wildcard Schemas](/sync/advanced/schemas-and-connections#wildcard-schemas-postgres).

When using wildcard table names, the original table suffix is available as the special `_table_suffix` column, which you can use to filter rows:

```sql theme={null}
SELECT * FROM "todos_%" AS todos WHERE _table_suffix != 'archived'
```

When no table alias is provided, the original table name is preserved.

`publish_via_partition_root` on the publication is not supported. The individual partitions must be published.
