Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfcfb4d1

Browse files
committed
Changes due to fixed DEFAULT behaviour.
1 parent629e895 commitfcfb4d1

File tree

9 files changed

+148
-155
lines changed

9 files changed

+148
-155
lines changed

‎src/test/regress/GNUmakefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.11 1997/09/24 08:35:07 vadim Exp $
10+
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.12 1997/10/17 09:57:49 vadim Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -43,7 +43,8 @@ endif
4343
all:$(INFILES)
4444
cd input;$(MAKE) all;cd ..
4545
cd output;$(MAKE) all;cd ..
46-
$(MAKE) -C ../../../contrib/spi REFINT_VERBOSE=1 refint$(DLSUFFIX)
46+
$(MAKE) -C ../../../contrib/spi REFINT_VERBOSE=1 refint$(DLSUFFIX)\
47+
autoinc$(DLSUFFIX)
4748

4849
#
4950
# run the test

‎src/test/regress/data/constrf.data

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
\N\N\N
1+
5!check failed6
2+
7check failed6

‎src/test/regress/data/constro.data

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
\N\N\N
2-
\N\N\N
3-
\N\N\N
1+
4!check failed5
2+
6OK4

‎src/test/regress/expected/triggers.out

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -163,60 +163,65 @@ QUERY: create sequence ttdummy_seq increment 10 start 0 minvalue 0;
163163
QUERY: create table tttest (
164164
price_idint4,
165165
price_valint4,
166-
price_onint4 default nextval('ttdummy_seq'),
166+
price_onint4,
167167
price_offint4 default 999999
168168
);
169-
QUERY: insert into tttest values (1, 1, null, null);
170-
QUERY: insert into tttest values (2, 2, null, null);
171-
QUERY: insert into tttest values (3, 3, null, null);
172169
QUERY: create trigger ttdummy
173170
before delete or update on tttest
174171
for each row
175172
execute procedure
176173
ttdummy (price_on, price_off);
174+
QUERY: create trigger ttserial
175+
before insert or update on tttest
176+
for each row
177+
execute procedure
178+
autoinc (price_on, ttdummy_seq);
179+
QUERY: insert into tttest values (1, 1, null);
180+
QUERY: insert into tttest values (2, 2, null);
181+
QUERY: insert into tttest values (3, 3, 0);
177182
QUERY: select * from tttest;
178183
price_id|price_val|price_on|price_off
179184
--------+---------+--------+---------
180-
1| 1| 0| 999999
181-
2| 2|10| 999999
182-
3| 3|20| 999999
185+
1| 1|10| 999999
186+
2| 2|20| 999999
187+
3| 3|30| 999999
183188
(3 rows)
184189

185190
QUERY: delete from tttest where price_id = 2;
186191
QUERY: select * from tttest;
187192
price_id|price_val|price_on|price_off
188193
--------+---------+--------+---------
189-
1| 1| 0| 999999
190-
3| 3|20| 999999
191-
2| 2|10|30
194+
1| 1|10| 999999
195+
3| 3|30| 999999
196+
2| 2|20|40
192197
(3 rows)
193198

194199
QUERY: select * from tttest where price_off = 999999;
195200
price_id|price_val|price_on|price_off
196201
--------+---------+--------+---------
197-
1| 1| 0| 999999
198-
3| 3|20| 999999
202+
1| 1|10| 999999
203+
3| 3|30| 999999
199204
(2 rows)
200205

201206
QUERY: update tttest set price_val = 30 where price_id = 3;
202207
QUERY: select * from tttest;
203208
price_id|price_val|price_on|price_off
204209
--------+---------+--------+---------
205-
1| 1| 0| 999999
206-
2| 2|10|30
207-
3| 30|40| 999999
208-
3| 3|20|40
210+
1| 1|10| 999999
211+
2| 2|20|40
212+
3| 30|50| 999999
213+
3| 3|30|50
209214
(4 rows)
210215

211216
QUERY: update tttest set price_id = 5 where price_id = 3;
212217
QUERY: select * from tttest;
213218
price_id|price_val|price_on|price_off
214219
--------+---------+--------+---------
215-
1| 1| 0| 999999
216-
2| 2|10|30
217-
3| 3|20|40
218-
5| 30|50| 999999
219-
3| 30|40|50
220+
1| 1|10| 999999
221+
2| 2|20|40
222+
3| 3|30|50
223+
5| 30|60| 999999
224+
3| 30|50|60
220225
(5 rows)
221226

222227
QUERY: select set_ttdummy(0);
@@ -230,20 +235,20 @@ QUERY: update tttest set price_off = 999999 where price_val = 30;
230235
QUERY: select * from tttest;
231236
price_id|price_val|price_on|price_off
232237
--------+---------+--------+---------
233-
1| 1| 0| 999999
234-
2| 2|10|30
235-
3| 3|20|40
236-
3| 30|40| 999999
238+
1| 1|10| 999999
239+
2| 2|20|40
240+
3| 3|30|50
241+
3| 30|50| 999999
237242
(4 rows)
238243

239244
QUERY: update tttest set price_id = 5 where price_id = 3;
240245
QUERY: select * from tttest;
241246
price_id|price_val|price_on|price_off
242247
--------+---------+--------+---------
243-
1| 1| 0| 999999
244-
2| 2|10|30
245-
5| 3|20|40
246-
5| 30|40| 999999
248+
1| 1|10| 999999
249+
2| 2|20|40
250+
5| 3|30|50
251+
5| 30|50| 999999
247252
(4 rows)
248253

249254
QUERY: select set_ttdummy(1);
@@ -264,16 +269,16 @@ QUERY: update tttest set price_on = -1 where price_id = 1;
264269
QUERY: select * from tttest;
265270
price_id|price_val|price_on|price_off
266271
--------+---------+--------+---------
267-
2| 2|10|30
268-
5| 3|20|40
269-
5| 30|40| 999999
272+
2| 2|20|40
273+
5| 3|30|50
274+
5| 30|50| 999999
270275
1| 1| -1| 999999
271276
(4 rows)
272277

273-
QUERY: select * from tttest where price_on <=25 and price_off >25 and price_id = 5;
278+
QUERY: select * from tttest where price_on <=35 and price_off >35 and price_id = 5;
274279
price_id|price_val|price_on|price_off
275280
--------+---------+--------+---------
276-
5| 3|20|40
281+
5| 3|30|50
277282
(1 row)
278283

279284
QUERY: drop table tttest;

‎src/test/regress/input/constraints.source

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ INSERT INTO DEFAULT_TBL VALUES (1, 'thomas', 57.0613);
1414
INSERT INTO DEFAULT_TBL VALUES (1, 'bruce');
1515
INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654);
1616
INSERT INTO DEFAULT_TBL (x) VALUES ('tgl');
17+
INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0);
1718

1819
SELECT '' AS four, * FROM DEFAULT_TBL;
1920

@@ -66,28 +67,30 @@ CREATE SEQUENCE INSERT_SEQ;
6667

6768
CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'),
6869
y TEXT DEFAULT '-NULL-', z INT DEFAULT -1 * currval('insert_seq') )
69-
CONSTRAINT INSERT_CON CHECK (x > 3 AND y <> 'check failed' AND x < 8),
70+
CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
7071
CHECK x + z = 0;
7172

7273
INSERT INTO INSERT_TBL VALUES (null, null, null);
73-
INSERT INTO INSERT_TBL VALUES (null, null, -2);
74+
INSERT INTO INSERT_TBL(x,z) VALUES (2, -2);
7475

7576
SELECT * FROM INSERT_TBL;
7677
SELECT nextval('insert_seq');
7778

78-
INSERT INTO INSERT_TBL VALUES (null, null, null);
79-
INSERT INTO INSERT_TBL VALUES (1, null, -2);
80-
INSERT INTO INSERT_TBL VALUES (7, null, -7);
79+
INSERT INTO INSERT_TBL(y) VALUES ('Y');
80+
INSERT INTO INSERT_TBL(y) VALUES ('Y');
81+
INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
82+
INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7);
8183
INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
8284
INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
83-
INSERT INTO INSERT_TBL VALUES (null, null, null);
85+
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
8486
SELECT * FROM INSERT_TBL;
85-
INSERT INTO INSERT_TBL VALUES (null,'check failed',5);
86-
INSERT INTO INSERT_TBL VALUES (5, 'check failed', null);
87-
INSERT INTO INSERT_TBL VALUES (5, '!check failed', null);
88-
INSERT INTO INSERT_TBL VALUES (null, null, null);
87+
INSERT INTO INSERT_TBL(y,z) VALUES ('check failed',4);
88+
INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed');
89+
INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed');
90+
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
8991
SELECT * FROM INSERT_TBL;
90-
INSERT INTO INSERT_TBL VALUES (null, null, null);
92+
SELECT nextval('insert_seq');
93+
INSERT INTO INSERT_TBL(y) VALUES ('Y');
9194
SELECT currval('insert_seq');
9295

9396
--
@@ -99,13 +102,14 @@ DROP SEQUENCE INSERT_SEQ;
99102
CREATE SEQUENCE INSERT_SEQ START 4;
100103
CREATE TABLE TEMP (xd INT, yd TEXT, zd INT);
101104

102-
SELECT nextval('insert_seq');
103-
INSERT INTO TEMP VALUES (null, null, null);
105+
INSERT INTO TEMP VALUES (null, 'Y', null);
104106
INSERT INTO TEMP VALUES (5, '!check failed', null);
105107
INSERT INTO TEMP VALUES (null, 'try again', null);
106-
INSERT INTO INSERT_TBL SELECT * FROM TEMP;
108+
INSERT INTO INSERT_TBL(y) select yd from TEMP;
107109
SELECT * FROM INSERT_TBL;
108110
INSERT INTO INSERT_TBL SELECT * FROM TEMP WHERE yd = 'try again';
111+
INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM TEMP WHERE yd = 'try again';
112+
INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM TEMP WHERE yd = 'try again';
109113
SELECT * FROM INSERT_TBL;
110114

111115
DROP TABLE TEMP;
@@ -115,28 +119,20 @@ DROP TABLE TEMP;
115119
--
116120

117121
UPDATE INSERT_TBL SET x = NULL WHERE x = 6;
118-
SELECT currval('insert_seq');
119-
SELECT * FROM INSERT_TBL;
120-
121122
UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
122-
SELECT * FROM INSERT_TBL;
123-
124123
UPDATE INSERT_TBL SET x = -z, z = -x;
124+
UPDATE INSERT_TBL SET x = z, z = x;
125125
SELECT * FROM INSERT_TBL;
126126

127127
--
128128
-- Check constraints on COPY FROM
129129
--
130130

131-
CREATE SEQUENCE COPY_SEQ START 4;
132-
CREATE TABLE COPY_TBL (x INT DEFAULT nextval('copy_seq'),
133-
y TEXT DEFAULT '-NULL-', z INT DEFAULT -1 * currval('copy_seq') )
134-
CONSTRAINT COPY_CON CHECK (x > 3 AND y <> 'check failed' AND x < 7 ),
135-
CHECK x + z = 0;
131+
CREATE TABLE COPY_TBL (x INT, y TEXT, z INT)
132+
CONSTRAINT COPY_CON CHECK (x > 3 AND y <> 'check failed' AND x < 7 );
136133

137134
COPY COPY_TBL FROM '_OBJWD_/data/constro.data';
138135
SELECT * FROM COPY_TBL;
139136
COPY COPY_TBL FROM '_OBJWD_/data/constrf.data';
140137

141138
SELECT * FROM COPY_TBL;
142-
select nextval('copy_seq') - 1 as currval;

‎src/test/regress/input/create_function_1.source

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ CREATE FUNCTION check_foreign_key ()
2525
LANGUAGE 'c'
2626
;
2727

28+
CREATE FUNCTION autoinc ()
29+
RETURNS opaque
30+
AS '_OBJWD_/../../../contrib/spi/autoinc_DLSUFFIX_'
31+
LANGUAGE 'c'
32+
;
33+
2834
CREATE FUNCTION funny_dup17 ()
2935
RETURNS opaque
3036
AS '_OBJWD_/regress_DLSUFFIX_'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp