Skip to content

Commit

Permalink
sql: fix a non-deterministic DELETE ... USING logic test
Browse files Browse the repository at this point in the history
Previously, a logic test testing ORDER BY and LIMIT in
DELETE ... USING statements would sometimes return a different
row from the USING table when run through stress tests,
due to the ORDER BY ... LIMIT clause allowing the USING to join
on either of two rows. This fix changes the output columns of
the RETURNING to ensure it only returns columns from the target
table and ensures deterministic output.

Release note: None

Epic: support DELETE FROM ... USING
  • Loading branch information
faizaanmadhani committed Oct 19, 2022
1 parent f5c524e commit c63273e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/sql/logictest/testdata/logic_test/delete
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@ DELETE FROM u_a AS foo USING u_b AS bar WHERE bar.a > foo.c ORDER BY bar.a DESC

# Test aliased table names, ORDER BY and LIMIT where ORDER BY references the target
# table.
query ITIIT
DELETE FROM u_a AS foo USING u_b AS bar WHERE bar.a > foo.c ORDER BY foo.a DESC LIMIT 3 RETURNING *;
query ITI
DELETE FROM u_a AS foo USING u_b AS bar WHERE bar.a > foo.c ORDER BY foo.a DESC LIMIT 3 RETURNING foo.*;
----
7 d 35 40 d
6 d 30 40 d
5 d 25 40 d
7 d 35
6 d 30
5 d 25

query ITI rowsort
SELECT * FROM u_a;
Expand Down

0 comments on commit c63273e

Please sign in to comment.