Re: Enforcing referential integrity against a HSTORE column

From: Dane Foster <studdugie(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Enforcing referential integrity against a HSTORE column
Date: 2016-01-02 17:27:26
Message-ID: CA+WxinLt04eu+9mjvBMBE9MbB8XssP=bMFSxhCfTuk3jKNcA-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jan 2, 2016 at 12:19 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 01/02/2016 08:13 AM, Dane Foster wrote:
>
> Ccing list.
>
>> On Sat, Jan 2, 2016 at 10:30 AM, Adrian Klaver
>> <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>>
>> On 01/01/2016 07:47 PM, Dane Foster wrote:
>>
>> Hello,
>>
>> I'm moving a MySQL database to PostgreSQL and redesigning parts
>> of it to
>> take advantage of PostgreSQL's richer type system and other
>> advance
>> features. Currently I am attempting to replace a table of
>> name/value
>> pair data w/ a hstore column. But now that the data will no
>> longer be
>> flattened out in a table I need to manually handle referential
>> integrity
>>
>>
>> And the benefit is?
>> ​
>>
>> ​
>> The benefit is supposed to be client side simplicity. The data in these
>> particular tables are ultimately consumed by JavaScript as JSON on the
>> front end to populate/maintain a dynamic HTML for​m. So I was attempting
>> to build a model that more closely reflects how the data is used because
>> the people using the data aren't SQL folks and the code that converts
>> the data from table/rows to JSON is not straight forward for my audience.
>>
>
> In that case you may want to look at the JSON types, json and/or
> jsonb(depending on Postgres version):
>
>
> http://www.postgresql.org/docs/9.4/interactive/datatype-json.html
>
> ​That's exactly what I did. The json_object_agg function sealed the deal.​

> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

Dane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-01-02 17:28:21 Re: Ubuntu 15.04 Installing Oracle_fdw
Previous Message Adrian Klaver 2016-01-02 17:19:34 Re: Enforcing referential integrity against a HSTORE column