Skip to content

time(NULL) > time('13:30:00') Generated as A SQL Query #8

@hankcs

Description

@hankcs

Dear authors,

I found sometimes the SQL statements generated by OpenDF is wrong that its where clause contains time(NULL) > time('13:30:00') which will never gets evaluated to true. E.g.,

Dialog 15

GUID: 47aa12c3-d912-47ac-b585-03dcd4ac3827 :

  • U1: Add a meeting with Anna today at 1pm.
  • A1: Is this good?
  • U2: Do I have a meeting after that one as well?
  • A2: Yes, I found one event today after 1:30. It's "Quick Meet" from 3:00 PM to 3:30 PM.

Program:

 CreateEvent(
    AND(
       with_attendee(
          Anna ) ,
       starts_at(
          Today(
             ) ) ,
       starts_at(
          NumberPM(
             1 ) ) ) ) 

 do(
    Let(
       x0 ,
       :end(
          refer(
             Event?(
                ) ) ) ) ,
    GTf(
       size(
          FindEvents(
             AND(
                starts_at(
                   :date(
                      $ x0 ) ) ,
                starts_at(
                   GT(
                      :time(
                         $ x0 ) ) ) ) ) ) ,
       0 ) ) 

SQL:

SELECT event.id, event.subject, event.starts_at, event.ends_at, event.location_id, event.organizer_id, location.name, location.always_free FROM event LEFT OUTER JOIN location ON event.location_id = location.id WHERE (date(event.starts_at) = date('2022-01-03') AND time(NULL) > time('13:30:00'))

The where clause should be WHERE (date(event.starts_at) = date('2022-01-03') AND time(event.starts_at) > time('13:30:00'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions