Skip to content

Commit 2c48b3d

Browse files
committed
here are the copy2.sql and copy2.out files for the new regression
tests Brent Verner
1 parent a90db34 commit 2c48b3d

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

src/test/regress/expected/copy2.out

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
CREATE TABLE x (
2+
a serial,
3+
b int,
4+
c text not null default 'stuff',
5+
d text not null,
6+
e text
7+
);
8+
NOTICE: CREATE TABLE will create implicit sequence 'x_a_seq' for SERIAL column 'x.a'
9+
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'x_a_key' for table 'x'
10+
CREATE FUNCTION fn_x_before () RETURNS OPAQUE AS '
11+
BEGIN
12+
NEW.e := ''before trigger fired''::text;
13+
return NEW;
14+
END;
15+
' language 'plpgsql';
16+
CREATE FUNCTION fn_x_after () RETURNS OPAQUE AS '
17+
BEGIN
18+
UPDATE x set e=''after trigger fired'' where c=''stuff'';
19+
return NULL;
20+
END;
21+
' language 'plpgsql';
22+
CREATE TRIGGER trg_x_after AFTER INSERT ON x
23+
FOR EACH ROW EXECUTE PROCEDURE fn_x_after();
24+
CREATE TRIGGER trg_x_before BEFORE INSERT ON x
25+
FOR EACH ROW EXECUTE PROCEDURE fn_x_before();
26+
COPY x (a,b,c,d,e) from stdin;
27+
COPY x (b,d) from stdin;
28+
COPY x (b,d) from stdin;
29+
COPY x (a,b,c,d,e) from stdin;
30+
COPY x TO stdout;
31+
10000 21 31 41 before trigger fired
32+
10001 22 32 42 before trigger fired
33+
10002 23 33 43 before trigger fired
34+
10003 24 34 44 before trigger fired
35+
10004 25 35 45 before trigger fired
36+
10005 26 36 46 before trigger fired
37+
1 1 stuff test_1 after trigger fired
38+
2 2 stuff test_2 after trigger fired
39+
3 3 stuff test_3 after trigger fired
40+
4 4 stuff test_4 after trigger fired
41+
5 5 stuff test_5 after trigger fired
42+
DROP TABLE x;
43+
DROP SEQUENCE x_a_seq;
44+
DROP FUNCTION fn_x_before();
45+
DROP FUNCTION fn_x_after();

src/test/regress/sql/copy2.sql

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
CREATE TABLE x (
2+
a serial,
3+
b int,
4+
c text not null default 'stuff',
5+
d text not null,
6+
e text
7+
);
8+
9+
CREATE FUNCTION fn_x_before () RETURNS OPAQUE AS '
10+
BEGIN
11+
NEW.e := ''before trigger fired''::text;
12+
return NEW;
13+
END;
14+
' language 'plpgsql';
15+
16+
CREATE FUNCTION fn_x_after () RETURNS OPAQUE AS '
17+
BEGIN
18+
UPDATE x set e=''after trigger fired'' where c=''stuff'';
19+
return NULL;
20+
END;
21+
' language 'plpgsql';
22+
23+
CREATE TRIGGER trg_x_after AFTER INSERT ON x
24+
FOR EACH ROW EXECUTE PROCEDURE fn_x_after();
25+
26+
CREATE TRIGGER trg_x_before BEFORE INSERT ON x
27+
FOR EACH ROW EXECUTE PROCEDURE fn_x_before();
28+
29+
COPY x (a,b,c,d,e) from stdin;
30+
10000 21 31 41 51
31+
\.
32+
33+
COPY x (b,d) from stdin;
34+
1 test_1
35+
\.
36+
37+
COPY x (b,d) from stdin;
38+
2 test_2
39+
3 test_3
40+
4 test_4
41+
5 test_5
42+
\.
43+
44+
COPY x (a,b,c,d,e) from stdin;
45+
10001 22 32 42 52
46+
10002 23 33 43 53
47+
10003 24 34 44 54
48+
10004 25 35 45 55
49+
10005 26 36 46 56
50+
\.
51+
52+
COPY x TO stdout;
53+
DROP TABLE x;
54+
DROP SEQUENCE x_a_seq;
55+
DROP FUNCTION fn_x_before();
56+
DROP FUNCTION fn_x_after();

0 commit comments

Comments
 (0)