Skip to content

Commit

Permalink
test(regress): enable delete (#13277)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuefengze authored Nov 7, 2023
1 parent e3c8649 commit 04999f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/tests/regress/data/expected/delete.out
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
CREATE TABLE delete_test (
id SERIAL PRIMARY KEY,
id INTEGER PRIMARY KEY,
a INT,
b text
);
INSERT INTO delete_test (a) VALUES (10);
INSERT INTO delete_test (a, b) VALUES (50, repeat('x', 10000));
INSERT INTO delete_test (id, a) VALUES (1, 10);
INSERT INTO delete_test (id, a, b) VALUES (2, 50, repeat('x', 10000));
INSERT INTO delete_test (a) VALUES (100);
-- allow an alias to be specified for DELETE's target table
DELETE FROM delete_test AS dt WHERE dt.a > 75;
Expand All @@ -15,7 +15,7 @@ ERROR: invalid reference to FROM-clause entry for table "delete_test"
LINE 1: DELETE FROM delete_test dt WHERE delete_test.a > 25;
^
HINT: Perhaps you meant to reference the table alias "dt".
SELECT id, a, char_length(b) FROM delete_test;
SELECT id, a, char_length(b) FROM delete_test ORDER BY id;
id | a | char_length
----+----+-------------
1 | 10 |
Expand Down
2 changes: 1 addition & 1 deletion src/tests/regress/data/schedule
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

test: boolean varchar text int2 int4 int8 float4 float8 comments
test: strings date time timestamp interval
test: case arrays
test: case arrays delete
test: jsonb
test: regex
14 changes: 7 additions & 7 deletions src/tests/regress/data/sql/delete.sql
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
CREATE TABLE delete_test (
id SERIAL PRIMARY KEY,
id INTEGER PRIMARY KEY,
a INT,
b text
);

INSERT INTO delete_test (a) VALUES (10);
INSERT INTO delete_test (a, b) VALUES (50, repeat('x', 10000));
INSERT INTO delete_test (a) VALUES (100);
INSERT INTO delete_test (id, a) VALUES (1, 10);
INSERT INTO delete_test (id, a, b) VALUES (2, 50, repeat('x', 10000));
--@ INSERT INTO delete_test (a) VALUES (100);

-- allow an alias to be specified for DELETE's target table
DELETE FROM delete_test AS dt WHERE dt.a > 75;
--@ DELETE FROM delete_test AS dt WHERE dt.a > 75;

-- if an alias is specified, don't allow the original table name
-- to be referenced
DELETE FROM delete_test dt WHERE delete_test.a > 25;
--@ DELETE FROM delete_test dt WHERE delete_test.a > 25;

SELECT id, a, char_length(b) FROM delete_test;
SELECT id, a, char_length(b) FROM delete_test ORDER BY id;

-- delete a row with a TOASTed value
DELETE FROM delete_test WHERE a > 25;
Expand Down

0 comments on commit 04999f0

Please sign in to comment.