summaryrefslogtreecommitdiff
path: root/tests/agg.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-03-25 16:41:51 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-03-25 16:41:51 -0400
commitff8b80dbb7cc9e5b8a48efbbf6f2f1009e1ab68e (patch)
tree27a26f3ab429e010514e95f29c6f3a0a3aa44381 /tests/agg.ur
parenta987a1ae26ee20ba32cfb85a0d38797067619105 (diff)
'AS' clauses for expression columns may be omitted
Diffstat (limited to 'tests/agg.ur')
-rw-r--r--tests/agg.ur17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/agg.ur b/tests/agg.ur
index 55e22c28..19a8644b 100644
--- a/tests/agg.ur
+++ b/tests/agg.ur
@@ -1,13 +1,14 @@
table t1 : {A : int, B : string, C : float}
table t2 : {A : float, D : int, E : option string}
-val q1 = (SELECT COUNT( * ) AS X FROM t1)
-val q2 = (SELECT AVG(t1.A) AS X FROM t1)
-val q3 = (SELECT SUM(t1.C) AS X FROM t1)
-val q4 = (SELECT MIN(t1.B) AS X, MAX(t1.A) AS Y FROM t1)
-val q5 = (SELECT SUM(t1.A) AS X FROM t1 GROUP BY t1.B)
-val q6 = (SELECT COUNT(t2.E) AS N FROM t2 GROUP BY t2.D)
+val q1 : sql_query [] _ _ = (SELECT COUNT( * ) FROM t1)
+val q2 : sql_query [] _ _ = (SELECT AVG(t1.A) FROM t1)
+val q3 : sql_query [] _ _ = (SELECT SUM(t1.C) FROM t1)
+val q4 : sql_query [] _ _ = (SELECT MIN(t1.B), MAX(t1.A) FROM t1)
+val q5 : sql_query [] _ _ = (SELECT SUM(t1.A) FROM t1 GROUP BY t1.B)
+val q6 = (SELECT COUNT(t2.E) FROM t2 GROUP BY t2.D)
fun main () : transaction page =
- xml <- queryX q6 (fn r => <xml>{[r.N]};</xml>);
- return <xml><body>{xml}</body></xml>
+ xml <- queryX q6 (fn r => <xml>{[r.1]};</xml>);
+ xml2 <- queryX q4 (fn r => <xml>{[r.1]}, {[r.2]};</xml>);
+ return <xml><body>{xml}<br/>{xml2}</body></xml>