hstore in DB9 is a metadata-only shim — CREATE EXTENSION hstore succeeds and registers extension metadata, but the hstore type itself does not exist. Any attempt to use hstore as a column type or cast to hstore will fail with ERROR: type "hstore" does not exist.
For new code, use JSONB instead. JSONB provides a superset of hstore functionality with full operator support, better performance, and broad ecosystem support.
Feature Supported CREATE EXTENSION hstoreYes — registers extension metadata only hstore column typeNo — type "hstore" does not exist Cast from text No — 'key=>value'::hstore fails with type error Basic key access (->) No — type does not exist Containment (@>) No — type does not exist
Feature Status JSONB Alternative %, ?, ?&, `?` operators Not supported `hstore hstore` concatenation hs - key deletionNot supported jsonb - keyakeys(), avals(), hstore_to_array()Not supported jsonb_object_keys(), jsonb_each()hstore_to_json(), hstore_to_jsonb()Not supported Cast directly with ::jsonb populate_record(), hstore_to_record()Not supported jsonb_populate_record()slice(), skeys(), svals()Not supported jsonb operators
If you have existing code using hstore, JSONB provides equivalent functionality with full operator support:
-- hstore: CREATE TABLE with hstore column
-- hstore: INSERT 'key=>value' syntax
INSERT INTO settings ( data ) VALUES ( '{"theme": "dark", "lang": "en"}' );
-- hstore: data->'key' (returns TEXT)
SELECT data ->> 'theme' FROM settings;
-- hstore: data @> 'key=>value'
SELECT * FROM settings WHERE data @> '{"theme": "dark"}' ;
-- hstore: delete a key data - 'key'
UPDATE settings SET data = data - 'theme' ;
-- hstore: get all keys akeys(data)
SELECT jsonb_object_keys( data ) FROM settings;
Feature hstore (DB9) JSONB Key-value storage Not available (type missing) Full support Nested values No Yes Operator support None Full GIN indexing No Yes Schema validation No Yes (check constraints) Ecosystem support Limited Universal
Limit Value hstore type Does not exist — metadata shim only Operators available None — type does not exist Recommended alternative JSONB — full operator support