Re: How to find earlest possible start times for given duration excluding reservations

From: Thom Brown <thom(at)linux(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to find earlest possible start times for given duration excluding reservations
Date: 2014-10-28 21:47:34
Message-ID: CAA-aLv6eJTH0ibVhXZKkWdFfDFNugo5gDS7VxVVBbLwrv6Xd2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 28 October 2014 21:07, Andrus <kobruleht2(at)hot(dot)ee> wrote:

> Hi!
>
> >A correction to this. As it stands, it will show times like the
> following:
>
> Thank you.
> I posted your solution as alternative to Erwin answer in
>
> http://stackoverflow.com/questions/26608683/how-to-find-first-free-start-times-from-reservations-in-postgres
>
>

A further tweak; add the following to the WHERE clause:

AND EXTRACT(DOW FROM times.period) != 0

This will ensure Sundays are excluded. I don't know if you want Saturdays
excluded, but you can easily adjust it for that.

Thom

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jorge Arevalo 2014-10-29 01:03:22 Query optimization
Previous Message Andrus 2014-10-28 21:07:20 Re: How to find earlest possible start times for given duration excluding reservations