---
title: "Choose exact types · Agent Wranglers"
url: https://agentwranglers.se/playbook/data/schema-design/exact-types
updated: 2026-10-20
licence: "All rights reserved"
---

# Choose exact types

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Schema design](https://agentwranglers.se/playbook/data/schema-design)
- Rule: Store each value in the type that means it. Money is an exact number, time is a time with a zone, and true or false is a boolean.
- How: Store money as integer cents or `numeric`, never as a floating point `float`, `real` or `double`. Store moments in time as `timestamptz` in PostgreSQL, or as UTC in other databases, and convert to local time only for display. `timestamptz` stores the moment in UTC and does not keep the original zone, so store the zone name in its own column when it matters. Use date, boolean and JSON types instead of text, and `jsonb` rather than `json` in PostgreSQL. In SQLite, declare tables `STRICT` so it refuses values of the wrong type. In MySQL, use the `utf8mb4` character set, because the old `utf8` cannot store emoji.
- Check: A query over the catalog lists every float column and every timestamp without a zone. The list is empty, or each entry is documented as not money and stored as UTC.

Example:

```sql
-- Bad: 0.1 + 0.2 is not 0.3 in floating point, and the zone is lost
price float, ordered_at timestamp
-- Good
price_cents bigint NOT NULL, ordered_at timestamptz NOT NULL
-- Check in PostgreSQL: expect no rows
SELECT table_name, column_name, data_type FROM information_schema.columns
WHERE table_schema = 'public'
  AND data_type IN ('real', 'double precision', 'timestamp without time zone');
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers data playbook: https://agentwranglers.se/playbook/data/schema-design/exact-types`.

- Previous: [Enforce rules with constraints](https://agentwranglers.se/playbook/data/schema-design/constraints)
- Next: [Give every row a stable key](https://agentwranglers.se/playbook/data/schema-design/stable-keys)
- [Schema design](https://agentwranglers.se/playbook/data/schema-design)
