File tree 7 files changed +1491
-0
lines changed
7 files changed +1491
-0
lines changed Original file line number Diff line number Diff line change
1
+ Test suite for PL/pgSQL
2
+
3
+ Scenario:
4
+
5
+ A building with a modern TP cabel installation where any
6
+ of the wall connectors can be used to plug in phones,
7
+ ethernet interfaces or local office hubs. The backside
8
+ of the wall connectors is wired to one of several patch-
9
+ fields in the building.
10
+
11
+ In the patchfields, there are hubs and all the slots
12
+ representing the wall connectors. In addition there are
13
+ slots that can represent a phone line from the central
14
+ phone system.
15
+
16
+ Triggers ensure consistency of the patching information.
17
+
18
+ Functions are used to build up powerful views that let
19
+ you look behind the wall when looking at a patchfield
20
+ or into a room.
21
+
22
+
Original file line number Diff line number Diff line change
1
+ --
2
+ -- PL/pgSQL language declaration
3
+ --
4
+ -- $Header: /cvsroot/pgsql/src/pl/plpgsql/test/Attic/mklang.sql,v 1.1 1998/08/24 19:16:27 momjian Exp $
5
+ --
6
+
7
+ create function plpgsql_call_handler () returns opaque
8
+ as ' /usr/local/pgsql/lib/plpgsql.so'
9
+ language ' C' ;
10
+
11
+ create trusted procedural language ' plpgsql'
12
+ handler plpgsql_call_handler
13
+ lancompiler ' PL/pgSQL' ;
14
+
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ DB=plpgsql_test
4
+ export DB
5
+
6
+ FRONTEND=" psql -n -e -q"
7
+ export FRONTEND
8
+
9
+ echo " *** destroy old $DB database ***"
10
+ destroydb $DB
11
+
12
+ echo " *** create new $DB database ***"
13
+ createdb $DB
14
+
15
+ echo " *** install PL/pgSQL ***"
16
+ $FRONTEND -f mklang.sql -d $DB > /dev/null 2>&1
17
+
18
+ echo " *** create tables ***"
19
+ $FRONTEND -f tables.sql -d $DB > output/tables.out 2>&1
20
+ if cmp -s output/tables.out expected/tables.out ; then
21
+ echo " OK"
22
+ else
23
+ echo " FAILED"
24
+ fi
25
+
26
+ echo " *** create triggers ***"
27
+ $FRONTEND -f triggers.sql -d $DB > output/triggers.out 2>&1
28
+ if cmp -s output/triggers.out expected/triggers.out ; then
29
+ echo " OK"
30
+ else
31
+ echo " FAILED"
32
+ fi
33
+
34
+ echo " *** create views and support functions ***"
35
+ $FRONTEND -f views.sql -d $DB > output/views.out 2>&1
36
+ if cmp -s output/views.out expected/views.out ; then
37
+ echo " OK"
38
+ else
39
+ echo " FAILED"
40
+ fi
41
+
42
+ echo " *** running tests ***"
43
+ $FRONTEND -f test.sql -d $DB > output/test.out 2>&1
44
+ if cmp -s output/test.out expected/test.out ; then
45
+ echo " OK"
46
+ else
47
+ echo " FAILED"
48
+ fi
49
+
Original file line number Diff line number Diff line change
1
+ -- ************************************************************
2
+ -- *
3
+ -- * Tables for the patchfield test of PL/pgSQL
4
+ -- *
5
+ -- * $Header: /cvsroot/pgsql/src/pl/plpgsql/test/Attic/tables.sql,v 1.1 1998/08/24 19:16:27 momjian Exp $
6
+ -- *
7
+ -- ************************************************************
8
+
9
+ create table Room (
10
+ roomno char (8 ),
11
+ comment text
12
+ );
13
+
14
+ create unique index Room_rno on Room using btree (roomno bpchar_ops);
15
+
16
+
17
+ create table WSlot (
18
+ slotname char (20 ),
19
+ roomno char (8 ),
20
+ slotlink char (20 ),
21
+ backlink char (20 )
22
+ );
23
+
24
+ create unique index WSlot_name on WSlot using btree (slotname bpchar_ops);
25
+
26
+
27
+ create table PField (
28
+ name text ,
29
+ comment text
30
+ );
31
+
32
+ create unique index PField_name on PField using btree (name text_ops);
33
+
34
+
35
+ create table PSlot (
36
+ slotname char (20 ),
37
+ pfname text ,
38
+ slotlink char (20 ),
39
+ backlink char (20 )
40
+ );
41
+
42
+ create unique index PSlot_name on PSlot using btree (slotname bpchar_ops);
43
+
44
+
45
+ create table PLine (
46
+ slotname char (20 ),
47
+ phonenumber char (20 ),
48
+ comment text ,
49
+ backlink char (20 )
50
+ );
51
+
52
+ create unique index PLine_name on PLine using btree (slotname bpchar_ops);
53
+
54
+
55
+ create table Hub (
56
+ name char (14 ),
57
+ comment text ,
58
+ nslots integer
59
+ );
60
+
61
+ create unique index Hub_name on Hub using btree (name bpchar_ops);
62
+
63
+
64
+ create table HSlot (
65
+ slotname char (20 ),
66
+ hubname char (14 ),
67
+ slotno integer ,
68
+ slotlink char (20 )
69
+ );
70
+
71
+ create unique index HSlot_name on HSlot using btree (slotname bpchar_ops);
72
+ create index HSlot_hubname on HSlot using btree (hubname bpchar_ops);
73
+
74
+
75
+ create table System (
76
+ name text ,
77
+ comment text
78
+ );
79
+
80
+ create unique index System_name on System using btree (name text_ops);
81
+
82
+
83
+ create table IFace (
84
+ slotname char (20 ),
85
+ sysname text ,
86
+ ifname text ,
87
+ slotlink char (20 )
88
+ );
89
+
90
+ create unique index IFace_name on IFace using btree (slotname bpchar_ops);
91
+
92
+
93
+ create table PHone (
94
+ slotname char (20 ),
95
+ comment text ,
96
+ slotlink char (20 )
97
+ );
98
+
99
+ create unique index PHone_name on PHone using btree (slotname bpchar_ops);
100
+
101
+
You can’t perform that action at this time.
0 commit comments