PostgreSQL
 SQL >> Database >  >> RDS >> PostgreSQL

Accedere a una colonna HSTORE con libpq

libpqtypes sembra avere un certo supporto per hstore. In alternativa, puoi evitare di gestire la rappresentazione testuale di hstore nel codice client.

Puoi espandere l'hstore lato server:

SELECT t.id, k, v FROM thetable t, LATERAL each(t.hstorefield);

Oppure usa hstore_to_array o hstore_to_matrix, se ti trovi a tuo agio con la rappresentazione ad array di PostgreSQL. Ricorda che la funzione each() richiede l'estensione hstore installata nel database.