Skip to content

Require unique values

A Postgres unique index stops two records sharing a value. Turn it on as you add a field or later. The nine types that carry it, and what a violation says.

Updated November 2026

Some values are only useful if no two records share one, like an SKU, an order number, or an email that identifies a customer. Require unique values is the switch for that, in the field editor. Switching it on creates a unique index on the Postgres table underneath, and Postgres itself refuses the duplicate, so an import can't slip one through the way it might get past a check in the app. Two people saving the same value at the same instant can't both succeed.

Which fields can have it

It's available on the types that hold one plain value: single line text, email, phone, web address, number, currency, percent, date, and single select.

The other types can't have it, each for its own reason. Long text is prose, not a key. A checkbox has two possible values. Multi-select, member, link and attachment cells hold lists. And on a computed field (formula, lookup or rollup) the rule would apply to a value nobody types, so nobody could fix a violation.

On a new field or an existing one

You can switch it on while adding a field, or later in Edit field…. When the field already has data, Tabla checks it first. If two records already share a value, the save is refused and the message says how many values are shared ("2 values are already shared by more than one record"), so you can filter for them, make them different, and switch it on again. Turning it off always works, and it changes none of the field's values.

Over the API, PATCH /api/fields/:id with "unique": true or "unique": false in options switches it the same way. An options update that doesn't mention unique leaves it as it was.

Empty cells never collide. The rule applies to values, and many records can have none.

What a violation looks like

The rule is the same for every kind of write: typing in the grid, pasting, imports, and the API. The entire write is refused, all or nothing, so a batch of 100 records with one duplicate saves zero records. The error names the field and the clashing value. This one is copied word for word from an actual attempt:

{
  "error": {
    "code": "bad_request",
    "message": "\"SKU\" must be unique — \"PLNT-001\" already exists."
  }
}

The status is HTTP 400, like any refused write. See /guides/api-errors-and-limits.

A record in the trash doesn't block its value from being reused. If another record has the value by the time you restore, the trashed record stays in the trash and the dialog says why, naming the field and not the value: "Can't restore: another record already uses its value in “SKU”." Other records restored in the same click come back as usual. To bring it back, change or delete the record that now has the value, then restore again. Over the API, POST /api/tables/:id/trash/restore refuses the whole batch with a 400 that names the records and the field, and restores none of them.

What to use it for, and what not to

It suits identifiers: SKUs, invoice numbers, membership codes, and tables with one record per email that an upsert merges on.

Making a name field unique because duplicates feel untidy works less well. Sooner or later two customers will both be named Mona Adel, and the field will refuse the second one. Use it for values that identify a record, not for values that describe one. A display field doesn't need to be unique to do its job.

About Tabla

Tabla is a no-code database with Postgres underneath. Every feature is on every plan, you get a million records per database, and you can export your whole database in one file any day.

More guides