Skip to content

Commit

Permalink
Merge #90251
Browse files Browse the repository at this point in the history
90251: sql: fix a non-deterministic DELETE ... USING logic test r=faizaanmadhani a=faizaanmadhani

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: CRDB-5498

Co-authored-by: Faizaan Madhani <[email protected]>
  • Loading branch information
craig[bot] and faizaanmadhani committed Oct 19, 2022
2 parents e711c31 + 1404540 commit 0dbe60e
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 0dbe60e

Please sign in to comment.