11-- -
22source : query - compiler / query - compiler / tests / queries .rs
3+ assertion_line : 76
34expression : pretty
45input_file : query - compiler / query - compiler / tests / data / update - m2m - set .json
56snapshot_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