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
Copy file name to clipboardExpand all lines: quaint/src/visitor/postgres.rs
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -934,6 +934,28 @@ mod tests {
934
934
assert_eq!(expected.1, params);
935
935
}
936
936
937
+
#[test]
938
+
#[cfg(feature = "postgresql")]
939
+
fntest_insert_common_table_expression(){
940
+
let expected = expected_values(
941
+
"WITH \"inserted\" AS (INSERT INTO \"relations\" (\"parent_id\",\"child_id\") SELECT \"parent_id\", \"child_id\" FROM \"children\" WHERE \"child_id\" = $1 ON CONFLICT DO NOTHING RETURNING \"child_id\") SELECT \"child_id\" FROM \"inserted\"",
942
+
vec![10],
943
+
);
944
+
let selection = Select::from_table("children")
945
+
.columns(vec!["parent_id","child_id"])
946
+
.so_that("child_id".equals(10));
947
+
let insert = Insert::expression_into("relations",vec!["parent_id","child_id"], selection)
0 commit comments