Currently I'm implementing data base using PostgreSQL. I have the following database(Hope that ER-diagram fully describes it) 
What do you need to know about this database is that friend can take a rest and have a holiday that is presented in a holiday table by friend's id, start_date and end_date.
I want to create a PostgreSQL query that will find dates, when exactly N friends had a holiday. I'm confused with iterating over period between start and end date.(Every solution that will help with this query is okay).
Example: assume holiday table to have such a content
(1, '2012-05-23', '2012-05-27', 1)
(2, '2012-05-23', '2012-05-24', 2)
(3, '2012-05-24', '2012-05-26', 3)
Assume that friend table contain these three friends.
The output for number of friends = 3 will be '2012-05-24'.
For number of friends = 2 will be ('2012-05-23', '2012-05-25', '2012-05-26').