Sunday, September 21, 2008

Re: [HACKERS] Foreign key constraint for array-field?

Normalization is not a panacea here. Sometimes such normalization
creates too much overeat and a lot of additional code (especially if
there are a lot of such dependencies). Array support in Postgres is
quite handy; in my practive, moving from a_b_map to arrays economizes
hundreds of lines of stored procedure and calling application code.

Triggers are not very helpful here, because it is too boringly to
control that all needed tables has appropriate triggers (we need N + 1
triggers with unique code, where N is the number of referring tables).

So, built-in support looks much more interesting...

On Sun, Sep 21, 2008 at 8:46 AM, Joshua D. Drake <jd@commandprompt.com> wrote:
> David Fetter wrote:
>>
>> On Sun, Sep 21, 2008 at 04:38:56AM +0400, Dmitry Koterov wrote:
>>>
>>> Hello.
>>>
>>> Is it possible to create a foreign key constraint for ALL elements of
>>> an array field?
>>
>> Whether it's possible or not--it probably is--it's a very bad idea.
>> Just normalize :)
>
> +1
>
>>
>> Cheers,
>> David.
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

No comments: