Iván Sánchez Ortega wrote: > El Miércoles, 11 de Febrero de 2009, Stefan de Konink escribió: >>> I'm not a foreign keys guru myself but I think it may be difficult to >>> have one with the relation_members as designed currently. >> I have solved that by splitting the members in 3 distinct tables; but >> placed an explicit index so I can always retrieve the members in the >> order they were inserted. > > It can also be solved by nuking the "member_type" and "member_id" columns, > and > putting three new columns: "member_node_id", "member_way_id" > and "member_relation_id", all allowing NULL, with a foreign key to the > corresponding table, and with a cute custom constraint or even a view to make > sure two of these three columns are kept NULL.
I prefer not to go to the unnormalised way ;) And NULL on constraints are evil ;) Stefan _______________________________________________ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev