postgres arrays

Extending HoneySQL with Array Intersection

Turns out that Postgres has beautiful support for “array” field types. In one database of mine, I use this to keep track of the recipients of emails: DROP TABLE IF EXISTS "email_log" CASCADE; CREATE TABLE "email_log" ( id SERIAL PRIMARY KEY, sender TEXT NOT NULL, recipients TEXT[] NOT NULL, message TEXT, sent_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, info JSONB); -- Note the recipients TEXT[] definition: that's an array of texts. Now for the use-case: a user might have multiple email addresses, and the email_log tracks recipient ADDRESSES not user-ids.