3 ms·
These are good, I've forgotten about some of them as well. As to: EXCLUDE USING gist ( id WITH =, period WITH && );" What the heck?
by esaym 9y ago
These are good, I've forgotten about some of them as well. As to:
EXCLUDE USING gist (
id WITH =,
period WITH &&
);"
What the heck?
- waffle_ss 9y agoIt's so you can't define two billings for the same period (say, the same month). To prevent you from double-billing someone. && is the range operator that checks for overlap.[1] You have to use gist indexes to do this. And in fact this page doesn't mention it but you have to enable the btree_gist extension with: CREATE EXTENSION btree_gist; before the snippet above will work. [1]: https://www.postgresql.org/docs/current/static/functions-range.html#RANGE-OPERATORS-TABLE https://www.postgresql.org/docs/current/static/functions-ran...
- tokenizerrr 9y agoThey're very nifty, as you can use this to easily prevent all kinds of date range overlaps.