Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
103558: sql: add more udf mutations test coverage r=rharding6373 a=rharding6373

Adds coverage for queries like `SELECT f(x,y) FROM (VALUES ...) v(x,y)` where `f()` is a function containing a mutation.

Epic: none

Release note: None

103805: sql: fix flaky udf_delete r=rharding6373 a=rharding6373

Epic: none

Release note: None

Co-authored-by: rharding6373 <[email protected]>
  • Loading branch information
craig[bot] and rharding6373 committed May 23, 2023
3 parents 175fb99 + 29b80e5 + f530049 commit 4cc4319
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/udf_delete
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ $$
DELETE FROM u_a USING u_a u_a2 WHERE u_a.a = u_a2.c RETURNING *
$$ LANGUAGE SQL;

query T
query T rowsort
SELECT f_using_self_join();
----
(5,d,5,5,d,5)
Expand Down
14 changes: 14 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/udf_update
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ SELECT f2(5,32);
statement error pq: multiple modification subqueries of the same table \"t\" are not supported
SELECT f2(5,9), f2(7,11);

query T
SELECT f2(x,y) FROM (VALUES (1,16),(1,17)) v(x,y);
----
(1,16)
(1,17)

query II rowsort
SELECT * FROM t;
----
1 17
3 4
5 32
7 8

statement ok
CREATE TABLE t2 (a INT, b INT, c INT);
INSERT INTO t2 VALUES (1,2,3),(4,5,6),(7,8,9);
Expand Down
18 changes: 18 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/udf_upsert
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ NULL
statement error pq: multiple modification subqueries of the same table \"t_ocdn\" are not supported
SELECT f_ocdn(1,1,1), f_ocdn(3,2,2), f_ocdn(6,6,2), f_ocdn(2,1,1);

query T
SELECT f_ocdn(x, y, z) FROM (VALUES (1, 1, 1), (2, 2, 1), (3, 3, 3), (3, 4, 4)) v(x, y, z)
----
NULL
(2,2,1)
(3,3,3)
NULL

query III rowsort
SELECT * FROM t_ocdn
----
1 1 1
2 2 1
3 3 3


statement ok
CREATE FUNCTION f_ocdn_2vals(i INT, j INT, k INT, m INT, n INT, o INT) RETURNS RECORD AS
$$
Expand All @@ -45,6 +61,8 @@ query III rowsort
SELECT * FROM t_ocdn;
----
1 1 1
2 2 1
3 3 3
5 5 5

statement error pq: multiple modification subqueries of the same table \"t_ocdn\" are not supported
Expand Down

0 comments on commit 4cc4319

Please sign in to comment.