pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Create and access a dictionary type
Date: Wed, 5 Jan 2022 17:35:15 +0100
Message-ID: <bacb43b9-ec26-1adc-8334-dc2e74210c96@enterprisedb.com> (raw)
In-Reply-To: <def33987-b02b-c87d-f854-444989b80610@gmail.com>
References: <CA+i5JwYG_m7Ka2Sw_p9r5-3LrRqz=4HsuccX-7oz4+SMtbmvhA@mail.gmail.com>
	<c699f135-2326-0fda-6623-850da6101bc8@enterprisedb.com>
	<def33987-b02b-c87d-f854-444989b80610@gmail.com>

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





view thread (8+ messages)  latest in thread

Message-ID: <bacb43b9-ec26-1adc-8334-dc2e74210c96@enterprisedb.com>
Permalink:  ../bacb43b9-ec26-1adc-8334-dc2e74210c96@enterprisedb.com/
Also on:    postgresql.org/message-id/bacb43b9-ec26-1adc-8334-dc2e74210c96@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tomas.vondra@enterprisedb.com, ronljohnsonjr@gmail.com
  Subject: Re: Create and access a dictionary type
  In-Reply-To: <bacb43b9-ec26-1adc-8334-dc2e74210c96@enterprisedb.com>
  References: <CA+i5JwYG_m7Ka2Sw_p9r5-3LrRqz=4HsuccX-7oz4+SMtbmvhA@mail.gmail.com> <c699f135-2326-0fda-6623-850da6101bc8@enterprisedb.com> <def33987-b02b-c87d-f854-444989b80610@gmail.com> <bacb43b9-ec26-1adc-8334-dc2e74210c96@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox