# hstore — Postgres extension

> Key-value pairs in one column.

Source: https://scribase.com/extensions/hstore

Category: Data types. Version: 1.8. Optional, enabled per project.

## About

hstore stores a flat set of text keys and text values in one column, with operators to read, test and merge keys and GIN index support. For nested data jsonb is usually the better choice; hstore remains simple and compact for flat string maps.

## Enable it

```sql
create extension if not exists hstore with schema extensions;
```

## Example

```sql
select 'color => red, size => M'::hstore -> 'color';    -- red

select * from products where attributes ? 'size';
update products set attributes = attributes || 'size => L'::hstore where id = 1;
```

Upstream: https://www.postgresql.org/docs/17/hstore.html