Forum OpenACS Q&A: Host-node map data model bug

Collapse
Posted by Eric Lorenzo on

It also looks like there's a bug in the data model for the host-node map. Here's the table that stores the map:

create table host_node_map (
   host         varchar(200),
   node_id      integer not null
                constraint host_node_map_pk primary key
                constraint host_node_map_fk
                           references acs_objects (object_id)
);

Because the node_id is the primary key for the table, it's impossible to have multiple hostnames pointing to the same node (a restriction that makes no sense), but it is possible to have the same hostname appear multiple times, pointing to different node_ids (an ambiguous situation that would probably cause some pretty nasty breakage if it ever came to be).

I'm changing the table so that host, rather than node_id, is the primary key.