Skip to content

Commit bf023bd

Browse files
committed
Add a simple regress test for SERIAL --- it's not much,
but it's better than no test at all...
1 parent 37a71f9 commit bf023bd

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

src/test/regress/expected/create_misc.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,22 @@ INSERT INTO iportaltest (i, d, p)
149149
VALUES (1, 3.567, '(3.0,1.0),(4.0,2.0)'::polygon);
150150
INSERT INTO iportaltest (i, d, p)
151151
VALUES (2, 89.05, '(4.0,2.0),(3.0,1.0)'::polygon);
152+
---
153+
--- test creation of SERIAL column
154+
---
155+
CREATE TABLE serialTest (f1 text, f2 serial);
156+
NOTICE: CREATE TABLE will create implicit sequence 'serialtest_f2_seq' for SERIAL column 'serialtest.f2'
157+
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'serialtest_f2_key' for table 'serialtest'
158+
INSERT INTO serialTest VALUES ('foo');
159+
INSERT INTO serialTest VALUES ('bar');
160+
INSERT INTO serialTest VALUES ('force', 100);
161+
INSERT INTO serialTest VALUES ('wrong', NULL);
162+
ERROR: ExecAppend: Fail to add null value in not null attribute f2
163+
SELECT * FROM serialTest;
164+
f1 | f2
165+
-------+-----
166+
foo | 1
167+
bar | 2
168+
force | 100
169+
(3 rows)
170+

src/test/regress/expected/sanity_check.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ SELECT relname, relhasindex
4949
pg_trigger | t
5050
pg_type | t
5151
road | t
52+
serialtest | t
5253
shighway | t
5354
tenk1 | t
5455
tenk2 | t
55-
(43 rows)
56+
(44 rows)
5657

src/test/regress/output/misc.source

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,8 @@ SELECT user_relns() AS user_relns
607607
real_city
608608
reltime_tbl
609609
road
610+
serialtest
611+
serialtest_f2_seq
610612
shighway
611613
slow_emp4000
612614
street
@@ -621,7 +623,7 @@ SELECT user_relns() AS user_relns
621623
toyemp
622624
varchar_tbl
623625
xacttest
624-
(84 rows)
626+
(86 rows)
625627

626628
--SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))) AS equip_name;
627629
--

src/test/regress/sql/create_misc.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,16 @@ INSERT INTO iportaltest (i, d, p)
228228
INSERT INTO iportaltest (i, d, p)
229229
VALUES (2, 89.05, '(4.0,2.0),(3.0,1.0)'::polygon);
230230

231+
232+
---
233+
--- test creation of SERIAL column
234+
---
235+
236+
CREATE TABLE serialTest (f1 text, f2 serial);
237+
238+
INSERT INTO serialTest VALUES ('foo');
239+
INSERT INTO serialTest VALUES ('bar');
240+
INSERT INTO serialTest VALUES ('force', 100);
241+
INSERT INTO serialTest VALUES ('wrong', NULL);
242+
243+
SELECT * FROM serialTest;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy