hstore — Key-Value
PostgreSQL-compatible key-value store type.
Installation
Section titled “Installation”CREATE EXTENSION hstore;Note: The
hstoreextension in DB9 is primarily for client compatibility. It allows PostgreSQL clients and ORMs that expect hstore support to connect without errors.
Recommended: Use JSONB Instead
Section titled “Recommended: Use JSONB Instead”For key-value storage, consider using JSONB which offers richer functionality:
-- Recommended: Use JSONB for key-value dataCREATE TABLE settings ( id SERIAL PRIMARY KEY, data JSONB);
INSERT INTO settings (data) VALUES ('{"theme": "dark", "lang": "en"}');
-- Query JSONBSELECT data->>'theme' FROM settings;