Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
97e83468
Commit
97e83468
authored
Apr 25, 2011
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Regression tests for TOAST.
Kevin Grittner, per discussion of bug #5989
parent
b429519d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
10 deletions
+62
-10
src/test/regress/expected/delete.out
src/test/regress/expected/delete.out
+16
-7
src/test/regress/expected/insert.out
src/test/regress/expected/insert.out
+17
-0
src/test/regress/expected/update.out
src/test/regress/expected/update.out
+9
-0
src/test/regress/sql/delete.sql
src/test/regress/sql/delete.sql
+9
-3
src/test/regress/sql/insert.sql
src/test/regress/sql/insert.sql
+7
-0
src/test/regress/sql/update.sql
src/test/regress/sql/update.sql
+4
-0
No files found.
src/test/regress/expected/delete.out
View file @
97e83468
CREATE TABLE delete_test (
id SERIAL PRIMARY KEY,
a INT
a INT,
b text
);
NOTICE: CREATE TABLE will create implicit sequence "delete_test_id_seq" for serial column "delete_test.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "delete_test_pkey" for table "delete_test"
INSERT INTO delete_test (a) VALUES (10);
INSERT INTO delete_test (a
) VALUES (50
);
INSERT INTO delete_test (a
, b) VALUES (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;
...
...
@@ -16,11 +17,19 @@ 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
*
FROM delete_test;
id | a
----+----
1 | 10
2 | 50
SELECT
id, a, char_length(b)
FROM delete_test;
id | a
| char_length
----+----
+-------------
1 | 10
|
2 | 50
| 10000
(2 rows)
-- delete a row with a TOASTed value
DELETE FROM delete_test WHERE a > 25;
SELECT id, a, char_length(b) FROM delete_test;
id | a | char_length
----+----+-------------
1 | 10 |
(1 row)
DROP TABLE delete_test;
src/test/regress/expected/insert.out
View file @
97e83468
...
...
@@ -62,4 +62,21 @@ select * from inserttest;
2 | 3 | values are fun!
(7 rows)
--
-- TOASTed value test
--
insert into inserttest values(30, 50, repeat('x', 10000));
select col1, col2, char_length(col3) from inserttest;
col1 | col2 | char_length
------+------+-------------
| 3 | 7
| 5 | 7
| 5 | 4
| 7 | 7
10 | 20 | 2
-1 | 2 | 7
2 | 3 | 15
30 | 50 | 10000
(8 rows)
drop table inserttest;
src/test/regress/expected/update.out
View file @
97e83468
...
...
@@ -87,4 +87,13 @@ ERROR: invalid reference to FROM-clause entry for table "update_test"
LINE 1: UPDATE update_test AS t SET b = update_test.b + 10 WHERE t.a...
^
HINT: Perhaps you meant to reference the table alias "t".
-- Make sure that we can update to a TOASTed value.
UPDATE update_test SET c = repeat('x', 10000) WHERE c = 'car';
SELECT a, b, char_length(c) FROM update_test;
a | b | char_length
-----+----+-------------
100 | 20 |
11 | 41 | 10000
(2 rows)
DROP TABLE update_test;
src/test/regress/sql/delete.sql
View file @
97e83468
CREATE
TABLE
delete_test
(
id
SERIAL
PRIMARY
KEY
,
a
INT
a
INT
,
b
text
);
INSERT
INTO
delete_test
(
a
)
VALUES
(
10
);
INSERT
INTO
delete_test
(
a
)
VALUES
(
50
);
INSERT
INTO
delete_test
(
a
,
b
)
VALUES
(
50
,
repeat
(
'x'
,
10000
)
);
INSERT
INTO
delete_test
(
a
)
VALUES
(
100
);
-- allow an alias to be specified for DELETE's target table
...
...
@@ -14,6 +15,11 @@ DELETE FROM delete_test AS dt WHERE dt.a > 75;
-- to be referenced
DELETE
FROM
delete_test
dt
WHERE
delete_test
.
a
>
25
;
SELECT
*
FROM
delete_test
;
SELECT
id
,
a
,
char_length
(
b
)
FROM
delete_test
;
-- delete a row with a TOASTed value
DELETE
FROM
delete_test
WHERE
a
>
25
;
SELECT
id
,
a
,
char_length
(
b
)
FROM
delete_test
;
DROP
TABLE
delete_test
;
src/test/regress/sql/insert.sql
View file @
97e83468
...
...
@@ -28,4 +28,11 @@ insert into inserttest values(10, 20, '40'), (-1, 2, DEFAULT),
select
*
from
inserttest
;
--
-- TOASTed value test
--
insert
into
inserttest
values
(
30
,
50
,
repeat
(
'x'
,
10000
));
select
col1
,
col2
,
char_length
(
col3
)
from
inserttest
;
drop
table
inserttest
;
src/test/regress/sql/update.sql
View file @
97e83468
...
...
@@ -54,4 +54,8 @@ UPDATE update_test SET (a,b) = (select a,b FROM update_test where c = 'foo')
-- to the original table name
UPDATE
update_test
AS
t
SET
b
=
update_test
.
b
+
10
WHERE
t
.
a
=
10
;
-- Make sure that we can update to a TOASTed value.
UPDATE
update_test
SET
c
=
repeat
(
'x'
,
10000
)
WHERE
c
=
'car'
;
SELECT
a
,
b
,
char_length
(
c
)
FROM
update_test
;
DROP
TABLE
update_test
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment