Skip to content

Comment on Using Postgres Arrays in Djangoparent

Comments

I rarely use postgres arrays as an actual storage type, but have used them frequently in results (there are aggregation functions to turn multiple rows into an array). The common use is something like pulling a user's info and roles in a single query with the roles from the many to many relationship aggregated to an array, so the result is one row per user and only requires one trip to the db.. The other common use is similar to above, but for handing off to a stored procedure of some sort. I haven't found a use for it as a stored column type, however.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.