Re: How best to create and use associative array type in Postgres?

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How best to create and use associative array type in Postgres?
Date: 2022-01-05 16:11:28
Message-ID: CA+i5JwZRMwu_Mo8wfrS-_VWANG+RpaGEXth_orym-s_2joKKYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What do you think this attempt by using create type and create a function?

Managing Key/Value Pairs in PostgreSQL (justatheory.com)
<https://justatheory.com/2010/08/postgres-key-value-pairs/>

Regards,

David

On Wed, 5 Jan 2022 at 14:54, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Shaozhong SHI <shishaozhong(at)gmail(dot)com> writes:
> > How best to create and use associative array type in Postgres?
>
> I think the closest thing you'd find to that is jsonb, or
> contrib/hstore if you'd like something with a bit less complexity.
> The notation is unlikely to look much like Oracle, but they
> both have the ability to store sets of key/value pairs.
>
> https://www.postgresql.org/docs/current/datatype-json.html
> https://www.postgresql.org/docs/current/hstore.html
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-01-05 16:24:16 Re: How best to create and use associative array type in Postgres?
Previous Message Tom Lane 2022-01-05 14:54:25 Re: How best to create and use associative array type in Postgres?