I want a SQL query to check if a given timestamp falls within the open hours of a business. These open hours change depending on the time of year (seasonal hours) and the business is closed for certain holidays. I have a list of these dates, although they are subject to change.
What I want is a good structure for storing this information in the database and a function that looks like this:
CREATE OR REPLACE FUNCTION is_business_open(event TIMESTAMP) RETURNS BOOLEAN AS $_$
...
$_$
I'll be writing this in plpgsql
on PostgreSQL 8.2.x, if that makes a difference.