aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/insert.out
blob: 10d5ce49d587da5044950a96b880444976327d52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--
-- insert with DEFAULT in the target_list
--
create table inserttest (col1 int4, col2 int4 NOT NULL, col3 text default 'testing');
insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT, DEFAULT);
ERROR:  null value in column "col2" violates not-null constraint
insert into inserttest (col2, col3) values (3, DEFAULT);
insert into inserttest (col1, col2, col3) values (DEFAULT, 5, DEFAULT);
insert into inserttest values (DEFAULT, 5, 'test');
insert into inserttest values (DEFAULT, 7);
select * from inserttest;
 col1 | col2 |  col3   
------+------+---------
      |    3 | testing
      |    5 | testing
      |    5 | test
      |    7 | testing
(4 rows)

--
-- insert with similar expression / target_list values (all fail)
--
insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT);
ERROR:  INSERT has more target columns than expressions
insert into inserttest (col1, col2, col3) values (1, 2);
ERROR:  INSERT has more target columns than expressions
insert into inserttest (col1) values (1, 2);
ERROR:  INSERT has more expressions than target columns
insert into inserttest (col1) values (DEFAULT, DEFAULT);
ERROR:  INSERT has more expressions than target columns
select * from inserttest;
 col1 | col2 |  col3   
------+------+---------
      |    3 | testing
      |    5 | testing
      |    5 | test
      |    7 | testing
(4 rows)

drop table inserttest;