Re: Create and access a dictionary type - Mailing list pgsql-general

From Tomas Vondra
Subject Re: Create and access a dictionary type
Date
Msg-id bacb43b9-ec26-1adc-8334-dc2e74210c96@enterprisedb.com
Whole thread Raw
In response to Re: Create and access a dictionary type  (Ron <ronljohnsonjr@gmail.com>)
Responses Re: Create and access a dictionary type
List pgsql-general
On 1/5/22 17:24, Ron wrote:
> On 1/5/22 7:22 AM, Tomas Vondra wrote:
>> On 1/5/22 14:17, Shaozhong SHI wrote:
>>> Any examples in Postgres to create a dictionary type to store and 
>>> access key value pairs?
>>>
>>
>> I'd say JSONB can be used as an associative array, and e.g. in Python 
>> can map to dict data type.
> 
> The question confuses me.  Why isn't "create a table with Primary Key" 
> the answer to "Any examples in Postgres to create a dictionary type to 
> store and access key value pairs?"
> 

Well, yes - you can always decompose the dict and store it in an EAV, 
but sometimes it's more convenient to just use "nested" dictionary at 
the row level. Which is what a JSONB column does.

regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: Create and access a dictionary type
Next
From: Tomas Vondra
Date:
Subject: Re: Create and access a dictionary type