> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1500-to-1599/e1503.md).

# Error 1503: must include all columns in the table's partitioning function

| Error Code | SQLSTATE | Error                                      | Description                                                        |
| ---------- | -------- | ------------------------------------------ | ------------------------------------------------------------------ |
| 1503       | HY000    | ER\_UNIQUE\_KEY\_NEED\_ALL\_FIELDS\_IN\_PF | A %s must include all columns in the table's partitioning function |

## Possible Causes and Solutions

This error occurs when a primary key or unique key on a partitioned table does not include all columns used in the partitioning expression. The `%s` in the message is `PRIMARY KEY` or `UNIQUE INDEX`.

The storage engine checks each unique key one partition at a time. Duplicates in different partitions would go undetected, so every primary or unique key must contain the partitioning columns. See [Partitioning Limitations](https://mariadb.com/docs/server/server-usage/partitioning-tables/partitioning-limitations.md).

To resolve the error, do one of the following:

* Add the partitioning columns to the key.
* Change the partitioning expression to use columns the key already contains.
* For a unique key (not a primary key), create it with `USING HASH`.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
