[erlang-questions] Chicago Boss Array Fields in Models

David Welton davidnwelton@REDACTED
Fri May 30 10:57:04 CEST 2014

> I think arrays is not well supported for retrieve information from postgres,
> I afraid, if you go to a psql terminal and run a simple:
> SELECT emails FROM users;

You can get the raw data out without much trouble:

create table foo (emails varchar[]);

insert into foo (emails) values ('{"a", "b", "c"}');

boss_db:execute("select * from foo", []).

Keep in mind that, with Chicago Boss and Postgres

boss_db:execute("select * from foo", []).

uses a different underlying function than

boss_db:execute("select * from foo")

With the latter returning mostly binaries.

> You realise the output is the same that you get with boss_db. Perhaps you
> should normalice the data, create another table for emails and another model
> using -has or -belongs instead.

Normalizing the data might be a good idea in any case.

David N. Welton



More information about the erlang-questions mailing list