For instance, I have an app with a "project" with users that have different roles (owners and members). Right now, I'm modeling that with a join table that contains the role information. Would those be better as arrays? (I'm inclined to think not.)
Alternatively, I also have a messaging system in place, where the recipients probably would be better modeled with an array.
Anyway, this is great information, and it gives another, nice tool in the quiver. Thanks!
This is really useful if you want to do something like get all the posts with a certain set of tags: `select posts.tags && ARRAY['postgres', 'arrays']`.
It's also useful for implementing things like materialized paths if you're modeling hierarchies, or adjacency lists if you're modeling graphs I suppose.
Of course all of this could be done with small join tables, but the array intersection / set syntax gives you some nice tools.
That said, arrays are also terribly useful in computation. There are lots of vector operations that really don't make sense on a result set, but that PostgreSQL can compute very efficiently if presented with an array.
Instead of letting the SQL leak into my code, as in texts = ArrayField(dbtype="text", dimension=2) I want to write text = models.TextField() ''.Array(dimension=2) so can't djorm_pgarray.fields (or any other array-supporting ORM magic) add Array() to the Field base class?