[sr-dev] 'address' table and composite UNIQUE key for 'ip_addr' and 'mask' columns

Iñaki Baz Castillo ibc at aliax.net
Thu Apr 15 12:47:48 CEST 2010


2010/4/15 Juha Heinanen <jh at tutpro.com>:
> Iñaki Baz Castillo writes:
>
>  > Hi, 'ip_addr' and 'mask' columns (in 'address' table) should be a
>  > composite UNIQUE key as it doesn't make sense to have two entries
>  > sharing both values (the module would always take the first one).
>  > This would requiere a change in the DB schema. Opinions?
>
> i think that grp should also be included in the unique key.

Humm, I don't think so. Forget now the "port" field (which should also
be considered for the composite key):

Imagine two entries with same "ip_addr" and "mask" but differnt "grp".
This would be valid as you suggest, but it doesn't make sense as the
permissions module would get just the first entry and extract the
"grp" from it. This is, the composite key columns must be those used
by the search condition ("ip_addr", "mask" and "port").


-- 
Iñaki Baz Castillo
<ibc at aliax.net>



More information about the sr-dev mailing list