Skip to content

Commit 745b860

Browse files
committed
test(query-compiler): refresh m2m set pruning snapshots
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
1 parent 096a111 commit 745b860

2 files changed

Lines changed: 43 additions & 92 deletions

File tree

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
source: query-compiler/query-compiler/tests/queries.rs
3+
assertion_line: 76
34
expression: pretty
45
input_file: query-compiler/query-compiler/tests/data/update-m2m-set-empty.json
56
snapshot_kind: text
@@ -16,7 +17,8 @@ transaction
1617
}
1718
let 0 = unique (query «SELECT "public"."Post"."id", "public"."Post"."title",
1819
"public"."Post"."userId" FROM "public"."Post" WHERE
19-
"public"."Post"."id" = $1 LIMIT $2 OFFSET $3»
20+
("public"."Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET
21+
$3»
2022
params [const(BigInt(1)), const(BigInt(1)),
2123
const(BigInt(0))])
2224
in let 0 = unique (validate (get 0)
@@ -30,47 +32,20 @@ transaction
3032
[ rowCountNeq 0
3133
] orRaise "MISSING_RECORD");
3234
0$id = mapField id (get 0)
33-
in rawNestedReadUnique (query «SELECT "public"."Post"."id",
34-
"public"."Post"."title",
35-
"public"."Post"."userId" FROM
36-
"public"."Post" WHERE "public"."Post"."id"
37-
= $1 LIMIT $2 OFFSET $3»
38-
params [var(0$id as Int), const(BigInt(1)),
39-
const(BigInt(0))]
40-
fields {
41-
id: 0
42-
title: 1
43-
userId: 2
44-
}
45-
relations [categories on left.0 = right.2 many (query
46-
«SELECT
47-
"public"."Category"."id",
48-
"public"."Category"."name",
49-
"t0"."B"
50-
AS
51-
"CategoryToPost@Post"
52-
FROM
53-
"public"."Category"
54-
INNER
55-
JOIN
56-
"public"."_CategoryToPost"
57-
AS
58-
"t0"
59-
ON
60-
"t0"."A"
61-
=
62-
"public"."Category"."id"
63-
WHERE
64-
(1=1
65-
AND
66-
"t0"."B"
67-
=
68-
$1)
69-
OFFSET
70-
$2»
71-
params [var(@parent$id as Int),
72-
const(BigInt(0))]
73-
fields {
74-
id: 0
75-
name: 1
76-
})])
35+
in let @parent = unique (query «SELECT "public"."Post"."id",
36+
"public"."Post"."title",
37+
"public"."Post"."userId" FROM
38+
"public"."Post" WHERE "public"."Post"."id"
39+
= $1 LIMIT $2 OFFSET $3»
40+
params [var(0$id as Int), const(BigInt(1)),
41+
const(BigInt(0))])
42+
in let @parent$id = mapField id (get @parent)
43+
in join (get @parent)
44+
with (query «SELECT "public"."Category"."id",
45+
"public"."Category"."name", "t0"."B" AS
46+
"CategoryToPost@Post" FROM "public"."Category" INNER
47+
JOIN "public"."_CategoryToPost" AS "t0" ON "t0"."A"
48+
= "public"."Category"."id" WHERE (1=1 AND "t0"."B" =
49+
$1) OFFSET $2»
50+
params [var(@parent$id as Int),
51+
const(BigInt(0))]) on left.(id) = right.(CategoryToPost@Post) as @nested$categories
Lines changed: 23 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
source: query-compiler/query-compiler/tests/queries.rs
3+
assertion_line: 76
34
expression: pretty
45
input_file: query-compiler/query-compiler/tests/data/update-m2m-set.json
56
snapshot_kind: text
@@ -16,7 +17,8 @@ transaction
1617
}
1718
let 0 = unique (query «SELECT "public"."Post"."id", "public"."Post"."title",
1819
"public"."Post"."userId" FROM "public"."Post" WHERE
19-
"public"."Post"."id" = $1 LIMIT $2 OFFSET $3»
20+
("public"."Post"."id" = $1 AND 1=1) LIMIT $2 OFFSET
21+
$3»
2022
params [const(BigInt(1)), const(BigInt(1)),
2123
const(BigInt(0))])
2224
in let 0 = unique (validate (get 0)
@@ -27,8 +29,9 @@ transaction
2729
"public"."_CategoryToPost"."B" = ($1
2830
params [var(0$id as Int)]
2931
in let 2 = query «SELECT "public"."Category"."id" FROM
30-
"public"."Category" WHERE ("public"."Category"."id" =
31-
$1 OR "public"."Category"."id" = $2) OFFSET $3»
32+
"public"."Category" WHERE (("public"."Category"."id"
33+
= $1 AND 1=1) OR ("public"."Category"."id" = $2 AND
34+
1=1)) OFFSET $3»
3235
params [const(BigInt(1)), const(BigInt(2)),
3336
const(BigInt(0))]
3437
in let 0 = unique (validate (get 0)
@@ -46,47 +49,20 @@ transaction
4649
[ rowCountNeq 0
4750
] orRaise "MISSING_RECORD");
4851
0$id = mapField id (get 0)
49-
in rawNestedReadUnique (query «SELECT "public"."Post"."id",
50-
"public"."Post"."title",
51-
"public"."Post"."userId" FROM
52-
"public"."Post" WHERE "public"."Post"."id"
53-
= $1 LIMIT $2 OFFSET $3»
54-
params [var(0$id as Int), const(BigInt(1)),
55-
const(BigInt(0))]
56-
fields {
57-
id: 0
58-
title: 1
59-
userId: 2
60-
}
61-
relations [categories on left.0 = right.2 many (query
62-
«SELECT
63-
"public"."Category"."id",
64-
"public"."Category"."name",
65-
"t0"."B"
66-
AS
67-
"CategoryToPost@Post"
68-
FROM
69-
"public"."Category"
70-
INNER
71-
JOIN
72-
"public"."_CategoryToPost"
73-
AS
74-
"t0"
75-
ON
76-
"t0"."A"
77-
=
78-
"public"."Category"."id"
79-
WHERE
80-
(1=1
81-
AND
82-
"t0"."B"
83-
=
84-
$1)
85-
OFFSET
86-
$2»
87-
params [var(@parent$id as Int),
88-
const(BigInt(0))]
89-
fields {
90-
id: 0
91-
name: 1
92-
})])
52+
in let @parent = unique (query «SELECT "public"."Post"."id",
53+
"public"."Post"."title",
54+
"public"."Post"."userId" FROM
55+
"public"."Post" WHERE "public"."Post"."id"
56+
= $1 LIMIT $2 OFFSET $3»
57+
params [var(0$id as Int), const(BigInt(1)),
58+
const(BigInt(0))])
59+
in let @parent$id = mapField id (get @parent)
60+
in join (get @parent)
61+
with (query «SELECT "public"."Category"."id",
62+
"public"."Category"."name", "t0"."B" AS
63+
"CategoryToPost@Post" FROM "public"."Category" INNER
64+
JOIN "public"."_CategoryToPost" AS "t0" ON "t0"."A"
65+
= "public"."Category"."id" WHERE (1=1 AND "t0"."B" =
66+
$1) OFFSET $2»
67+
params [var(@parent$id as Int),
68+
const(BigInt(0))]) on left.(id) = right.(CategoryToPost@Post) as @nested$categories

0 commit comments

Comments
 (0)