insert.out
来自「postgresql8.3.4源码,开源数据库」· OUT 代码 · 共 58 行
OUT
58 行
---- 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 constraintinsert 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 expressionsinsert into inserttest (col1, col2, col3) values (1, 2);ERROR: INSERT has more target columns than expressionsinsert into inserttest (col1) values (1, 2);ERROR: INSERT has more expressions than target columnsinsert into inserttest (col1) values (DEFAULT, DEFAULT);ERROR: INSERT has more expressions than target columnsselect * from inserttest; col1 | col2 | col3 ------+------+--------- | 3 | testing | 5 | testing | 5 | test | 7 | testing(4 rows)---- VALUES test--insert into inserttest values(10, 20, '40'), (-1, 2, DEFAULT), ((select 2), (select i from (values(3)) as foo (i)), 'values are fun!');select * from inserttest; col1 | col2 | col3 ------+------+----------------- | 3 | testing | 5 | testing | 5 | test | 7 | testing 10 | 20 | 40 -1 | 2 | testing 2 | 3 | values are fun!(7 rows)drop table inserttest;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?