     "(" 0% call ")" 0% ; inline
 
 M: interval where ( spec obj -- )
-    dup [ from>> ] [ to>> ] bi
-    [ first fp-infinity? ] bi@ and [
-        2drop
-        " 1 = 1 " 0% ! dummy
-    ] [
-        [
-            [ from>> "from" where-interval ] [
-                nip [ from>> ] [ to>> ] bi
-                [ first fp-infinity? ] bi@ or [ " and " 0% ] unless
-            ] [ to>> "to" where-interval ] 2tri
-        ] in-parens
-    ] if ;
+    [
+        [ from>> "from" where-interval ] [
+            nip infinite-interval? [ " and " 0% ] unless
+        ] [ to>> "to" where-interval ] 2tri
+    ] in-parens ;
 
 M: sequence where ( spec obj -- )
     [


: query-make ( class quot -- )
    >r sql-props r>
    [ 0 sql-counter rot with-variable ] { "" { } { } } nmake
    <simple-statement> maybe-make-retryable ; inline

M: db begin-transaction ( -- ) "BEGIN" sql-command ;


M: string where ( spec obj -- ) object-where ;

: filter-slots ( tuple specs -- specs' )
    [
        slot-name>> swap get-slot-named
        dup double-infinite-interval? [ drop f ] when
    ] with filter ;

: where-clause ( tuple specs -- )
    dupd filter-slots
    dup empty? [
        2drop
    ] [
        " where " 0% [
            " and " 0%
        ] [
            2dup slot-name>> swap get-slot-named where
        ] interleave drop
    ] if ;

M: db <delete-tuple-statement> ( tuple table -- sql )
    [
        "delete from " 0% 0%
        where-clause
    ] query-make ;

M: db <select-by-slots-statement> ( tuple class -- statement )
