                  (-> (dsl/values
                       (dsl/row 1 2)
                       (dsl/row 3 4))
-                     (dsl/as-table "t1" "f1" "f2"))))]
+                     (dsl/to-table "t1" "f1" "f2"))))]
       (is (= (fmt/get-sql q {:dialect :pgsql})
              "select f1, f2 from (values(?, ?), (?, ?)) as \"t1\"(\"f1\", \"f2\")"))))
 


  (testing "Select clause with join and aliases"
    (let [q (-> (dsl/select-one)
                (dsl/from ["book" "b"])
                (dsl/join ["author" "a"])
                (dsl/on "b.authorid = a.id"))]
      (is (= (fmt/get-sql q)
             "select 1 \"one\" from book \"b\" join author \"a\" on (b.authorid = a.id)"))))

    (let [sq (-> (dsl/select (dsl/field "count(*)"))
                 (dsl/from :book)
                 (dsl/where "book.authorid = author.id"))
          q  (-> (dsl/select :fullname, (dsl/field sq "books"))
                 (dsl/from :author))]
      (is (= (fmt/get-sql q)
             "select fullname, (select count(*) from book where (book.authorid = author.id)) \"books\" from author"))))
