You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"SELECT 1 FROM assessments AS a WHERE a.id = $assessment_id FOR NO KEY UPDATE;",
147
+
)
148
+
.expect_statements(vec![
149
+
"SELECT 1 FROM assessments AS a WHERE a.id = $assessment_id FOR NO KEY UPDATE;",
150
+
]);
151
+
}
152
+
117
153
#[test]
118
154
fntest_crash_eof(){
119
155
Tester::from("CREATE INDEX \"idx_analytics_read_ratio\" ON \"public\".\"message\" USING \"btree\" (\"inbox_id\", \"timestamp\") INCLUDE (\"status\") WHERE (\"is_inbound\" = false and channel_type not in ('postal'', 'sms'));")
@@ -256,6 +292,55 @@ mod tests {
256
292
]);
257
293
}
258
294
295
+
#[test]
296
+
fnwith_recursive(){
297
+
Tester::from(
298
+
"
299
+
WITH RECURSIVE
300
+
template_questions AS (
301
+
-- non-recursive term that finds the ID of the template question (if any) for question_id
302
+
SELECT
303
+
tq.id,
304
+
tq.qid,
305
+
tq.course_id,
306
+
tq.template_directory
307
+
FROM
308
+
questions AS q
309
+
JOIN questions AS tq ON (
310
+
tq.qid = q.template_directory
311
+
AND tq.course_id = q.course_id
312
+
)
313
+
WHERE
314
+
q.id = $question_id
315
+
AND tq.deleted_at IS NULL
316
+
-- required UNION for a recursive WITH statement
317
+
UNION
318
+
-- recursive term that references template_questions again
319
+
SELECT
320
+
tq.id,
321
+
tq.qid,
322
+
tq.course_id,
323
+
tq.template_directory
324
+
FROM
325
+
template_questions AS q
326
+
JOIN questions AS tq ON (
327
+
tq.qid = q.template_directory
328
+
AND tq.course_id = q.course_id
329
+
)
330
+
WHERE
331
+
tq.deleted_at IS NULL
332
+
)
333
+
SELECT
334
+
id
335
+
FROM
336
+
template_questions
337
+
LIMIT
338
+
100;",
339
+
)
340
+
.assert_single_statement()
341
+
.assert_no_errors();
342
+
}
343
+
259
344
#[test]
260
345
fnwith_check(){
261
346
Tester::from("create policy employee_insert on journey_execution for insert to authenticated with check ((select private.organisation_id()) = organisation_id);")
0 commit comments