Re: Array of foreign key

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Thomas Poty <thomas(dot)poty(at)gmail(dot)com>
Cc: Andreas Kretschmer <andreas(at)a-kretschmer(dot)de>, pgsql-general(at)lists(dot)postgresql(dot)org, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Array of foreign key
Date: 2017-12-22 20:56:35
Message-ID: CANu8Fix5=6ZCusDfVHPkGt4x1fxKDk-v+wjsr6oaJt8T+iCx4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Dec 22, 2017 at 3:40 PM, Thomas Poty <thomas(dot)poty(at)gmail(dot)com> wrote:

> Actually, We are migrating from Mysql to postgresql and we have to replace
> sets of Mysql. The migration we will be done in 2 steps: First, in a like
> for like way. Second step will be using postgresql powerfulness
>
> I think the most like for like way to migrate sets is using enum array.
>
> Thank you Andreas.
>
> Thomas
>
>
> Le 22 déc. 2017 20:22, "Andreas Kretschmer" <andreas(at)a-kretschmer(dot)de> a
> écrit :
>
>> On 22 December 2017 20:02:43 CET, Thomas Poty <thomas(dot)poty(at)gmail(dot)com>
>> wrote:
>> >Hello all,
>> >
>> >I use postgresql 9.5 and I am looking for way to have a column which is
>> >an
>> >array of a foreign key. If what I read is correct it is currently not
>> >possible... Have you any idea how to implement this feature in a safe
>> >way
>>
>> Normalisation?
>>
>> Can you explain that a bit more, what's the use-case?
>>
>>
>> Regards, Andreas
>>
>>
>> --
>> 2ndQuadrant - The PostgreSQL Support Company
>>
>
Please DO NOT use EMUMs. That is old. They are hard to maintain. I also
know from experience that MySql does not check
integrity of enums. It's possible you can have data in a MySql table column
that is not valid for current enum constraint on that column.
EG: When porting, the enum for a columm (VALID) was "yes, no", but I found
a few that had "maybe" as data.

The way to go is to simply implement FOREIGN KEYs. Much easier to maintain
in PostgreSQL.

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2017-12-22 21:05:18 Re: Array of foreign key
Previous Message Thomas Poty 2017-12-22 20:40:41 Re: Array of foreign key