[Dbix-class] Dynamic constraints on PostgreSQL arrays

David Storrs dstorrs at dstorrs.com
Mon Nov 7 15:38:17 CET 2005


On Nov 7, 2005, at 9:04 AM, Kaare Rasmussen wrote:

>
> The reason being that I'd like to maintain integrity _and_ be  
> (somewhat) flexible at the same time. Somewhere in my system I'd  
> note that col{1} references table a column a1 and that col{2}  
> references table b column b1.

If you want flexibility, this seems like the wrong way to go about  
it.  The array type is only a good idea if what you are putting into  
it is both inherently ordered (days of the week, servers in a round- 
robin pool) and self-contained (i.e., does not require further  
documentation to explain what it means).

If you want a listing of col{1} -> a.a1, col{2} -> b.b1, then set it  
up as a table with columns "table" and "column" instead and use  
constraints appropriately to ensure uniqueness.


--Dks




More information about the Dbix-class mailing list