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
832c0a4f
Commit
832c0a4f
authored
Apr 27, 1997
by
Marc G. Fournier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split out a bunch more tests from misc.source so that the tester knows
what's being tested :)
parent
cac55460
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
654 additions
and
562 deletions
+654
-562
src/test/regress/input/misc.source
src/test/regress/input/misc.source
+0
-547
src/test/regress/sql/aggregates.sql
src/test/regress/sql/aggregates.sql
+132
-0
src/test/regress/sql/alter_table.sql
src/test/regress/sql/alter_table.sql
+159
-0
src/test/regress/sql/portals.sql
src/test/regress/sql/portals.sql
+168
-0
src/test/regress/sql/portals_p2.sql
src/test/regress/sql/portals_p2.sql
+96
-0
src/test/regress/sql/purge.sql
src/test/regress/sql/purge.sql
+30
-0
src/test/regress/sql/select_views.sql
src/test/regress/sql/select_views.sql
+11
-0
src/test/regress/sql/tests
src/test/regress/sql/tests
+24
-15
src/test/regress/sql/transactions.sql
src/test/regress/sql/transactions.sql
+34
-0
No files found.
src/test/regress/input/misc.source
View file @
832c0a4f
...
...
@@ -92,553 +92,6 @@ SELECT count(*) FROM onek where oidrand(onek.oid, 10);
SELECT count(*) FROM onek where oidrand(onek.oid, 10);
--
-- transaction blocks
--
BEGIN;
SELECT *
INTO TABLE xacttest
FROM aggtest;
INSERT INTO xacttest (a, b) VALUES (777, 777.777);
END;
-- should retrieve one value--
SELECT a FROM xacttest WHERE a > 100;
BEGIN;
CREATE TABLE disappear (a int4);
DELETE FROM aggtest;
-- should be empty
SELECT * FROM aggtest;
ABORT;
-- should not exist
SELECT oid FROM pg_class WHERE relname = 'disappear';
-- should have members again
SELECT * FROM aggtest;
--
-- portal manipulation
--
BEGIN;
DECLARE foo1 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo2 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo3 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo4 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo5 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo6 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo7 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo8 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo9 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo10 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo11 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo12 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo13 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo14 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo15 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo16 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo17 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo18 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo19 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo20 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo21 CURSOR FOR SELECT * FROM tenk1;
DECLARE foo22 CURSOR FOR SELECT * FROM tenk2;
DECLARE foo23 CURSOR FOR SELECT * FROM tenk1;
FETCH 1 in foo1;
FETCH 2 in foo2;
FETCH 3 in foo3;
FETCH 4 in foo4;
FETCH 5 in foo5;
FETCH 6 in foo6;
FETCH 7 in foo7;
FETCH 8 in foo8;
FETCH 9 in foo9;
FETCH 10 in foo10;
FETCH 11 in foo11;
FETCH 12 in foo12;
FETCH 13 in foo13;
FETCH 14 in foo14;
FETCH 15 in foo15;
FETCH 16 in foo16;
FETCH 17 in foo17;
FETCH 18 in foo18;
FETCH 19 in foo19;
FETCH 20 in foo20;
FETCH 21 in foo21;
FETCH 22 in foo22;
FETCH 23 in foo23;
FETCH backward 1 in foo23;
FETCH backward 2 in foo22;
FETCH backward 3 in foo21;
FETCH backward 4 in foo20;
FETCH backward 5 in foo19;
FETCH backward 6 in foo18;
FETCH backward 7 in foo17;
FETCH backward 8 in foo16;
FETCH backward 9 in foo15;
FETCH backward 10 in foo14;
FETCH backward 11 in foo13;
FETCH backward 12 in foo12;
FETCH backward 13 in foo11;
FETCH backward 14 in foo10;
FETCH backward 15 in foo9;
FETCH backward 16 in foo8;
FETCH backward 17 in foo7;
FETCH backward 18 in foo6;
FETCH backward 19 in foo5;
FETCH backward 20 in foo4;
FETCH backward 21 in foo3;
FETCH backward 22 in foo2;
FETCH backward 23 in foo1;
CLOSE foo1;
CLOSE foo2;
CLOSE foo3;
CLOSE foo4;
CLOSE foo5;
CLOSE foo6;
CLOSE foo7;
CLOSE foo8;
CLOSE foo9;
CLOSE foo10;
CLOSE foo11;
CLOSE foo12;
end;
EXTEND INDEX onek2_u1_prtl WHERE onek2.unique1 <= 60;
BEGIN;
DECLARE foo13 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 50;
DECLARE foo14 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 51;
DECLARE foo15 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 52;
DECLARE foo16 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 53;
DECLARE foo17 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 54;
DECLARE foo18 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 55;
DECLARE foo19 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 56;
DECLARE foo20 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 57;
DECLARE foo21 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 58;
DECLARE foo22 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 59;
DECLARE foo23 CURSOR FOR
SELECT * FROM onek WHERE unique1 = 60;
DECLARE foo24 CURSOR FOR
SELECT * FROM onek2 WHERE unique1 = 50;
DECLARE foo25 CURSOR FOR
SELECT * FROM onek2 WHERE unique1 = 60;
FETCH all in foo13;
FETCH all in foo14;
FETCH all in foo15;
FETCH all in foo16;
FETCH all in foo17;
FETCH all in foo18;
FETCH all in foo19;
FETCH all in foo20;
FETCH all in foo21;
FETCH all in foo22;
FETCH all in foo23;
FETCH all in foo24;
FETCH all in foo25;
CLOSE foo13;
CLOSE foo14;
CLOSE foo15;
CLOSE foo16;
CLOSE foo17;
CLOSE foo18;
CLOSE foo19;
CLOSE foo20;
CLOSE foo21;
CLOSE foo22;
CLOSE foo23;
CLOSE foo24;
CLOSE foo25;
END;
--
-- PURGE
--
-- we did two updates on each of these 10K tables up above. we should
-- therefore go from 10002 tuples (two of which are not visible without
-- using a time qual) to 10000.
--
-- vacuuming here also tests whether or not the hash index compaction
-- code works; this used to be commented out because the hash AM would
-- miss deleting a bunch of index tuples, which caused big problems when
-- you dereferenced the tids and found garbage..
--
-- absolute time
PURGE hash_f8_heap BEFORE 'now';
SELECT count(*) AS has_10002 FROM hash_f8_heap[,] h;
VACUUM hash_f8_heap;
SELECT count(*) AS has_10000 FROM hash_f8_heap[,] h;
-- relative time
PURGE hash_i4_heap AFTER '@ 1 second ago';
SELECT count(*) AS has_10002 FROM hash_i4_heap[,] h;
VACUUM hash_i4_heap;
SELECT count(*) AS has_10000 FROM hash_i4_heap[,] h;
--
-- add attribute
--
CREATE TABLE temp (initial int4);
ALTER TABLE temp ADD COLUMN a int4;
ALTER TABLE temp ADD COLUMN b char16;
ALTER TABLE temp ADD COLUMN c text;
ALTER TABLE temp ADD COLUMN d float8;
ALTER TABLE temp ADD COLUMN e float4;
ALTER TABLE temp ADD COLUMN f int2;
ALTER TABLE temp ADD COLUMN g polygon;
ALTER TABLE temp ADD COLUMN h abstime;
ALTER TABLE temp ADD COLUMN i char;
ALTER TABLE temp ADD COLUMN j abstime[];
ALTER TABLE temp ADD COLUMN k dt;
ALTER TABLE temp ADD COLUMN l tid;
ALTER TABLE temp ADD COLUMN m xid;
ALTER TABLE temp ADD COLUMN n oid8;
--ALTER TABLE temp ADD COLUMN o lock;
ALTER TABLE temp ADD COLUMN p smgr;
ALTER TABLE temp ADD COLUMN q point;
ALTER TABLE temp ADD COLUMN r lseg;
ALTER TABLE temp ADD COLUMN s path;
ALTER TABLE temp ADD COLUMN t box;
ALTER TABLE temp ADD COLUMN u tinterval;
ALTER TABLE temp ADD COLUMN v oidint4;
ALTER TABLE temp ADD COLUMN w oidname;
ALTER TABLE temp ADD COLUMN x float8[];
ALTER TABLE temp ADD COLUMN y float4[];
ALTER TABLE temp ADD COLUMN z int2[];
INSERT INTO temp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
v, w, x, y, z)
VALUES (4, 'char16', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}',
314159, '(1,1)', 512,
'1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
'(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["current" "infinity"]',
'1/3', '1,char16', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
SELECT * FROM temp;
DROP TABLE temp;
-- the wolf bug - schema mods caused inconsistent row descriptors
CREATE TABLE temp (
initial int4
) ARCHIVE = light;
ALTER TABLE temp ADD COLUMN a int4;
ALTER TABLE temp ADD COLUMN b char16;
ALTER TABLE temp ADD COLUMN c text;
ALTER TABLE temp ADD COLUMN d float8;
ALTER TABLE temp ADD COLUMN e float4;
ALTER TABLE temp ADD COLUMN f int2;
ALTER TABLE temp ADD COLUMN g polygon;
ALTER TABLE temp ADD COLUMN h abstime;
ALTER TABLE temp ADD COLUMN i char;
ALTER TABLE temp ADD COLUMN j abstime[];
ALTER TABLE temp ADD COLUMN k dt;
ALTER TABLE temp ADD COLUMN l tid;
ALTER TABLE temp ADD COLUMN m xid;
ALTER TABLE temp ADD COLUMN n oid8;
--ALTER TABLE temp ADD COLUMN o lock;
ALTER TABLE temp ADD COLUMN p smgr;
ALTER TABLE temp ADD COLUMN q point;
ALTER TABLE temp ADD COLUMN r lseg;
ALTER TABLE temp ADD COLUMN s path;
ALTER TABLE temp ADD COLUMN t box;
ALTER TABLE temp ADD COLUMN u tinterval;
ALTER TABLE temp ADD COLUMN v oidint4;
ALTER TABLE temp ADD COLUMN w oidname;
ALTER TABLE temp ADD COLUMN x float8[];
ALTER TABLE temp ADD COLUMN y float4[];
ALTER TABLE temp ADD COLUMN z int2[];
INSERT INTO temp (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s, t, u,
v, w, x, y, z)
VALUES (4, 'char16', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)',
'Mon May 1 00:30:30 1995', 'c', '{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}',
314159, '(1,1)', 512,
'1 2 3 4 5 6 7 8', 'magnetic disk', '(1.1,1.1)', '(4.1,4.1,3.1,3.1)',
'(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', '["current" "infinity"]',
'1/3', '1,char16', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}');
SELECT * FROM temp[,];
DROP TABLE temp;
--
-- rename -
-- should preserve indices
--
ALTER TABLE tenk1 RENAME TO ten_k;
-- 20 values, sorted
SELECT unique1 FROM ten_k WHERE unique1 < 20;
-- 20 values, sorted
SELECT unique2 FROM ten_k WHERE unique2 < 20;
-- 100 values, sorted
SELECT hundred FROM ten_k WHERE hundred = 50;
ALTER TABLE ten_k RENAME TO tenk1;
-- 5 values, sorted
SELECT unique1 FROM tenk1 WHERE unique1 < 5;
--
-- VIEW queries
--
-- test the views defined in create.source
--
SELECT * from street;
SELECT * from iexit;
SELECT * from toyemp where name='sharon';
--
-- AGGREGATES
--
SELECT avg(four) AS avg_1 FROM onek;
SELECT avg(a) AS avg_49 FROM aggtest WHERE a < 100;
SELECT avg(b) AS avg_107_943 FROM aggtest;
SELECT avg(gpa) AS avg_3_4 FROM student;
SELECT sum(four) AS sum_1500 FROM onek;
SELECT sum(a) AS sum_198 FROM aggtest;
SELECT sum(b) AS avg_431_773 FROM aggtest;
SELECT sum(gpa) AS avg_6_8 FROM student;
SELECT max(four) AS max_3 FROM onek;
SELECT max(a) AS max_100 FROM aggtest;
SELECT max(aggtest.b) AS max_324_78 FROM aggtest;
SELECT max(student.gpa) AS max_3_7 FROM student;
SELECT count(four) AS cnt_1000 FROM onek;
SELECT newavg(four) AS avg_1 FROM onek;
SELECT newsum(four) AS sum_1500 FROM onek;
SELECT newcnt(four) AS cnt_1000 FROM onek;
--
-- inheritance stress test
--
...
...
src/test/regress/sql/aggregates.sql
0 → 100644
View file @
832c0a4f
--
-- replace
--
--
-- BTREE
--
UPDATE
onek
SET
unique1
=
onek
.
unique1
+
1
;
UPDATE
onek
SET
unique1
=
onek
.
unique1
-
1
;
--
-- BTREE partial
--
-- UPDATE onek2
-- SET unique1 = onek2.unique1 + 1;
--UPDATE onek2
-- SET unique1 = onek2.unique1 - 1;
--
-- BTREE shutting out non-functional updates
--
-- the following two tests seem to take a long time on some
-- systems. This non-func update stuff needs to be examined
-- more closely. - jolly (2/22/96)
--
UPDATE
temp
SET
stringu1
=
reverse_c16
(
onek
.
stringu1
)
WHERE
onek
.
stringu1
=
'JBAAAA'
and
onek
.
stringu1
=
temp
.
stringu1
;
UPDATE
temp
SET
stringu1
=
reverse_c16
(
onek2
.
stringu1
)
WHERE
onek2
.
stringu1
=
'JCAAAA'
and
onek2
.
stringu1
=
temp
.
stringu1
;
DROP
TABLE
temp
;
--UPDATE person*
-- SET age = age + 1;
--UPDATE person*
-- SET age = age + 3
-- WHERE name = 'linda';
--
-- copy
--
COPY
onek
TO
'_OBJWD_/results/onek.data'
;
DELETE
FROM
onek
;
COPY
onek
FROM
'_OBJWD_/results/onek.data'
;
SELECT
unique1
FROM
onek
WHERE
unique1
<
2
;
DELETE
FROM
onek2
;
COPY
onek2
FROM
'_OBJWD_/results/onek.data'
;
SELECT
unique1
FROM
onek2
WHERE
unique1
<
2
;
COPY
BINARY
stud_emp
TO
'_OBJWD_/results/stud_emp.data'
;
DELETE
FROM
stud_emp
;
COPY
BINARY
stud_emp
FROM
'_OBJWD_/results/stud_emp.data'
;
SELECT
*
FROM
stud_emp
;
-- COPY aggtest FROM stdin;
-- 56 7.8
-- 100 99.097
-- 0 0.09561
-- 42 324.78
-- .
-- COPY aggtest TO stdout;
--
-- test the random function
--
-- count the number of tuples originally
SELECT
count
(
*
)
FROM
onek
;
-- select roughly 1/10 of the tuples
SELECT
count
(
*
)
FROM
onek
where
oidrand
(
onek
.
oid
,
10
);
-- select again, the count should be different
SELECT
count
(
*
)
FROM
onek
where
oidrand
(
onek
.
oid
,
10
);
--
-- AGGREGATES
--
SELECT
avg
(
four
)
AS
avg_1
FROM
onek
;
SELECT
avg
(
a
)
AS
avg_49
FROM
aggtest
WHERE
a
<
100
;
SELECT
avg
(
b
)
AS
avg_107_943
FROM
aggtest
;
SELECT
avg
(
gpa
)
AS
avg_3_4
FROM
student
;
SELECT
sum
(
four
)
AS
sum_1500
FROM
onek
;
SELECT
sum
(
a
)
AS
sum_198
FROM
aggtest
;
SELECT
sum
(
b
)
AS
avg_431_773
FROM
aggtest
;
SELECT
sum
(
gpa
)
AS
avg_6_8
FROM
student
;
SELECT
max
(
four
)
AS
max_3
FROM
onek
;
SELECT
max
(
a
)
AS
max_100
FROM
aggtest
;
SELECT
max
(
aggtest
.
b
)
AS
max_324_78
FROM
aggtest
;
SELECT
max
(
student
.
gpa
)
AS
max_3_7
FROM
student
;
SELECT
count
(
four
)
AS
cnt_1000
FROM
onek
;
SELECT
newavg
(
four
)
AS
avg_1
FROM
onek
;
SELECT
newsum
(
four
)
AS
sum_1500
FROM
onek
;
SELECT
newcnt
(
four
)
AS
cnt_1000
FROM
onek
;
src/test/regress/sql/alter_table.sql
0 → 100644
View file @
832c0a4f
--
-- add attribute
--
CREATE
TABLE
temp
(
initial
int4
);
ALTER
TABLE
temp
ADD
COLUMN
a
int4
;
ALTER
TABLE
temp
ADD
COLUMN
b
char16
;
ALTER
TABLE
temp
ADD
COLUMN
c
text
;
ALTER
TABLE
temp
ADD
COLUMN
d
float8
;
ALTER
TABLE
temp
ADD
COLUMN
e
float4
;
ALTER
TABLE
temp
ADD
COLUMN
f
int2
;
ALTER
TABLE
temp
ADD
COLUMN
g
polygon
;
ALTER
TABLE
temp
ADD
COLUMN
h
abstime
;
ALTER
TABLE
temp
ADD
COLUMN
i
char
;
ALTER
TABLE
temp
ADD
COLUMN
j
abstime
[];
ALTER
TABLE
temp
ADD
COLUMN
k
dt
;
ALTER
TABLE
temp
ADD
COLUMN
l
tid
;
ALTER
TABLE
temp
ADD
COLUMN
m
xid
;
ALTER
TABLE
temp
ADD
COLUMN
n
oid8
;
--ALTER TABLE temp ADD COLUMN o lock;
ALTER
TABLE
temp
ADD
COLUMN
p
smgr
;
ALTER
TABLE
temp
ADD
COLUMN
q
point
;
ALTER
TABLE
temp
ADD
COLUMN
r
lseg
;
ALTER
TABLE
temp
ADD
COLUMN
s
path
;
ALTER
TABLE
temp
ADD
COLUMN
t
box
;
ALTER
TABLE
temp
ADD
COLUMN
u
tinterval
;
ALTER
TABLE
temp
ADD
COLUMN
v
oidint4
;
ALTER
TABLE
temp
ADD
COLUMN
w
oidname
;
ALTER
TABLE
temp
ADD
COLUMN
x
float8
[];
ALTER
TABLE
temp
ADD
COLUMN
y
float4
[];
ALTER
TABLE
temp
ADD
COLUMN
z
int2
[];
INSERT
INTO
temp
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
,
j
,
k
,
l
,
m
,
n
,
p
,
q
,
r
,
s
,
t
,
u
,
v
,
w
,
x
,
y
,
z
)
VALUES
(
4
,
'char16'
,
'text'
,
4
.
1
,
4
.
1
,
2
,
'(4.1,4.1,3.1,3.1)'
,
'Mon May 1 00:30:30 1995'
,
'c'
,
'{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}'
,
314159
,
'(1,1)'
,
512
,
'1 2 3 4 5 6 7 8'
,
'magnetic disk'
,
'(1.1,1.1)'
,
'(4.1,4.1,3.1,3.1)'
,
'(0,2,4.1,4.1,3.1,3.1)'
,
'(4.1,4.1,3.1,3.1)'
,
'["current" "infinity"]'
,
'1/3'
,
'1,char16'
,
'{1.0,2.0,3.0,4.0}'
,
'{1.0,2.0,3.0,4.0}'
,
'{1,2,3,4}'
);
SELECT
*
FROM
temp
;
DROP
TABLE
temp
;
-- the wolf bug - schema mods caused inconsistent row descriptors
CREATE
TABLE
temp
(
initial
int4
)
ARCHIVE
=
light
;
ALTER
TABLE
temp
ADD
COLUMN
a
int4
;
ALTER
TABLE
temp
ADD
COLUMN
b
char16
;
ALTER
TABLE
temp
ADD
COLUMN
c
text
;
ALTER
TABLE
temp
ADD
COLUMN
d
float8
;
ALTER
TABLE
temp
ADD
COLUMN
e
float4
;
ALTER
TABLE
temp
ADD
COLUMN
f
int2
;
ALTER
TABLE
temp
ADD
COLUMN
g
polygon
;
ALTER
TABLE
temp
ADD
COLUMN
h
abstime
;
ALTER
TABLE
temp
ADD
COLUMN
i
char
;
ALTER
TABLE
temp
ADD
COLUMN
j
abstime
[];
ALTER
TABLE
temp
ADD
COLUMN
k
dt
;
ALTER
TABLE
temp
ADD
COLUMN
l
tid
;
ALTER
TABLE
temp
ADD
COLUMN
m
xid
;
ALTER
TABLE
temp
ADD
COLUMN
n
oid8
;
--ALTER TABLE temp ADD COLUMN o lock;
ALTER
TABLE
temp
ADD
COLUMN
p
smgr
;
ALTER
TABLE
temp
ADD
COLUMN
q
point
;
ALTER
TABLE
temp
ADD
COLUMN
r
lseg
;
ALTER
TABLE
temp
ADD
COLUMN
s
path
;
ALTER
TABLE
temp
ADD
COLUMN
t
box
;
ALTER
TABLE
temp
ADD
COLUMN
u
tinterval
;
ALTER
TABLE
temp
ADD
COLUMN
v
oidint4
;
ALTER
TABLE
temp
ADD
COLUMN
w
oidname
;
ALTER
TABLE
temp
ADD
COLUMN
x
float8
[];
ALTER
TABLE
temp
ADD
COLUMN
y
float4
[];
ALTER
TABLE
temp
ADD
COLUMN
z
int2
[];
INSERT
INTO
temp
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
,
j
,
k
,
l
,
m
,
n
,
p
,
q
,
r
,
s
,
t
,
u
,
v
,
w
,
x
,
y
,
z
)
VALUES
(
4
,
'char16'
,
'text'
,
4
.
1
,
4
.
1
,
2
,
'(4.1,4.1,3.1,3.1)'
,
'Mon May 1 00:30:30 1995'
,
'c'
,
'{Mon May 1 00:30:30 1995, Monday Aug 24 14:43:07 1992, epoch}'
,
314159
,
'(1,1)'
,
512
,
'1 2 3 4 5 6 7 8'
,
'magnetic disk'
,
'(1.1,1.1)'
,
'(4.1,4.1,3.1,3.1)'
,
'(0,2,4.1,4.1,3.1,3.1)'
,
'(4.1,4.1,3.1,3.1)'
,
'["current" "infinity"]'
,
'1/3'
,
'1,char16'
,
'{1.0,2.0,3.0,4.0}'
,
'{1.0,2.0,3.0,4.0}'
,
'{1,2,3,4}'
);
SELECT
*
FROM
temp
[,];
DROP
TABLE
temp
;
--
-- rename -
-- should preserve indices
--
ALTER
TABLE
tenk1
RENAME
TO
ten_k
;
-- 20 values, sorted
SELECT
unique1
FROM
ten_k
WHERE
unique1
<
20
;
-- 20 values, sorted
SELECT
unique2
FROM
ten_k
WHERE
unique2
<
20
;
-- 100 values, sorted
SELECT
hundred
FROM
ten_k
WHERE
hundred
=
50
;
ALTER
TABLE
ten_k
RENAME
TO
tenk1
;
-- 5 values, sorted
SELECT
unique1
FROM
tenk1
WHERE
unique1
<
5
;
src/test/regress/sql/portals.sql
0 → 100644
View file @
832c0a4f
--
-- portal manipulation
--
BEGIN
;
DECLARE
foo1
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo2
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo3
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo4
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo5
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo6
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo7
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo8
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo9
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo10
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo11
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo12
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo13
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo14
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo15
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo16
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo17
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo18
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo19
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo20
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo21
CURSOR
FOR
SELECT
*
FROM
tenk1
;
DECLARE
foo22
CURSOR
FOR
SELECT
*
FROM
tenk2
;
DECLARE
foo23
CURSOR
FOR
SELECT
*
FROM
tenk1
;
FETCH
1
in
foo1
;
FETCH
2
in
foo2
;
FETCH
3
in
foo3
;
FETCH
4
in
foo4
;
FETCH
5
in
foo5
;
FETCH
6
in
foo6
;
FETCH
7
in
foo7
;
FETCH
8
in
foo8
;
FETCH
9
in
foo9
;
FETCH
10
in
foo10
;
FETCH
11
in
foo11
;
FETCH
12
in
foo12
;
FETCH
13
in
foo13
;
FETCH
14
in
foo14
;
FETCH
15
in
foo15
;
FETCH
16
in
foo16
;
FETCH
17
in
foo17
;
FETCH
18
in
foo18
;
FETCH
19
in
foo19
;
FETCH
20
in
foo20
;
FETCH
21
in
foo21
;
FETCH
22
in
foo22
;
FETCH
23
in
foo23
;
FETCH
backward
1
in
foo23
;
FETCH
backward
2
in
foo22
;
FETCH
backward
3
in
foo21
;
FETCH
backward
4
in
foo20
;
FETCH
backward
5
in
foo19
;
FETCH
backward
6
in
foo18
;
FETCH
backward
7
in
foo17
;
FETCH
backward
8
in
foo16
;
FETCH
backward
9
in
foo15
;
FETCH
backward
10
in
foo14
;
FETCH
backward
11
in
foo13
;
FETCH
backward
12
in
foo12
;
FETCH
backward
13
in
foo11
;
FETCH
backward
14
in
foo10
;
FETCH
backward
15
in
foo9
;
FETCH
backward
16
in
foo8
;
FETCH
backward
17
in
foo7
;
FETCH
backward
18
in
foo6
;
FETCH
backward
19
in
foo5
;
FETCH
backward
20
in
foo4
;
FETCH
backward
21
in
foo3
;
FETCH
backward
22
in
foo2
;
FETCH
backward
23
in
foo1
;
CLOSE
foo1
;
CLOSE
foo2
;
CLOSE
foo3
;
CLOSE
foo4
;
CLOSE
foo5
;
CLOSE
foo6
;
CLOSE
foo7
;
CLOSE
foo8
;
CLOSE
foo9
;
CLOSE
foo10
;
CLOSE
foo11
;
CLOSE
foo12
;
end
;
src/test/regress/sql/portals_p2.sql
0 → 100644
View file @
832c0a4f
EXTEND
INDEX
onek2_u1_prtl
WHERE
onek2
.
unique1
<=
60
;
BEGIN
;
DECLARE
foo13
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
50
;
DECLARE
foo14
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
51
;
DECLARE
foo15
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
52
;
DECLARE
foo16
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
53
;
DECLARE
foo17
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
54
;
DECLARE
foo18
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
55
;
DECLARE
foo19
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
56
;
DECLARE
foo20
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
57
;
DECLARE
foo21
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
58
;
DECLARE
foo22
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
59
;
DECLARE
foo23
CURSOR
FOR
SELECT
*
FROM
onek
WHERE
unique1
=
60
;
DECLARE
foo24
CURSOR
FOR
SELECT
*
FROM
onek2
WHERE
unique1
=
50
;
DECLARE
foo25
CURSOR
FOR
SELECT
*
FROM
onek2
WHERE
unique1
=
60
;
FETCH
all
in
foo13
;
FETCH
all
in
foo14
;
FETCH
all
in
foo15
;
FETCH
all
in
foo16
;
FETCH
all
in
foo17
;
FETCH
all
in
foo18
;
FETCH
all
in
foo19
;
FETCH
all
in
foo20
;
FETCH
all
in
foo21
;
FETCH
all
in
foo22
;
FETCH
all
in
foo23
;
FETCH
all
in
foo24
;
FETCH
all
in
foo25
;
CLOSE
foo13
;
CLOSE
foo14
;
CLOSE
foo15
;
CLOSE
foo16
;
CLOSE
foo17
;
CLOSE
foo18
;
CLOSE
foo19
;
CLOSE
foo20
;
CLOSE
foo21
;
CLOSE
foo22
;
CLOSE
foo23
;
CLOSE
foo24
;
CLOSE
foo25
;
END
;
src/test/regress/sql/purge.sql
0 → 100644
View file @
832c0a4f
--
-- PURGE
--
-- we did two updates on each of these 10K tables up above. we should
-- therefore go from 10002 tuples (two of which are not visible without
-- using a time qual) to 10000.
--
-- vacuuming here also tests whether or not the hash index compaction
-- code works; this used to be commented out because the hash AM would
-- miss deleting a bunch of index tuples, which caused big problems when
-- you dereferenced the tids and found garbage..
--
-- absolute time
PURGE
hash_f8_heap
BEFORE
'now'
;
SELECT
count
(
*
)
AS
has_10002
FROM
hash_f8_heap
[,]
h
;
VACUUM
hash_f8_heap
;
SELECT
count
(
*
)
AS
has_10000
FROM
hash_f8_heap
[,]
h
;
-- relative time
PURGE
hash_i4_heap
AFTER
'@ 1 second ago'
;
SELECT
count
(
*
)
AS
has_10002
FROM
hash_i4_heap
[,]
h
;
VACUUM
hash_i4_heap
;
SELECT
count
(
*
)
AS
has_10000
FROM
hash_i4_heap
[,]
h
;
src/test/regress/sql/select_views.sql
0 → 100644
View file @
832c0a4f
--
-- VIEW queries
--
-- test the views defined in create.source
--
SELECT
*
from
street
;
SELECT
*
from
iexit
;
SELECT
*
from
toyemp
where
name
=
'sharon'
;
src/test/regress/sql/tests
View file @
832c0a4f
create_function_1
create_type
create_table
create_function_2
copy
create_misc
create_aggregate
create_operator
create_view
create_index
sanity_check
timespan
datetime
reltime
abstime
boolean
box
char
...
...
@@ -31,12 +16,36 @@ oidname
point
polygon
text
timespan
datetime
reltime
abstime
tinterval
create_function_1
create_type
create_table
create_function_2
copy
create_misc
create_aggregate
create_operator
create_view
create_index
sanity_check
select
select_into
select_distinct
select_distinct_on
transactions
portals
errors
btree_index
hash_index
aggregates.sql
select_views.sql
alter_table.sql
purge.sql
portals_p2.sql
misc
src/test/regress/sql/transactions.sql
0 → 100644
View file @
832c0a4f
--
-- transaction blocks
--
BEGIN
;
SELECT
*
INTO
TABLE
xacttest
FROM
aggtest
;
INSERT
INTO
xacttest
(
a
,
b
)
VALUES
(
777
,
777
.
777
);
END
;
-- should retrieve one value--
SELECT
a
FROM
xacttest
WHERE
a
>
100
;
BEGIN
;
CREATE
TABLE
disappear
(
a
int4
);
DELETE
FROM
aggtest
;
-- should be empty
SELECT
*
FROM
aggtest
;
ABORT
;
-- should not exist
SELECT
oid
FROM
pg_class
WHERE
relname
=
'disappear'
;
-- should have members again
SELECT
*
FROM
aggtest
;
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