15670430创建于 2020年12月28日历史提交
drop table if exists test_ud_eol;
NOTICE:  table "test_ud_eol" does not exist, skipping
create table test_ud_eol(id int, name char(100))  ;
insert into test_ud_eol values (1, 'zhangsan');
insert into test_ud_eol values (2, 'lisi');
insert into test_ud_eol values (3, 'wangwu');
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

copy test_ud_eol to '@abs_srcdir@/data/test_ud_eol.txt';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

--1 test 0x0d0a
copy test_ud_eol to '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d0a';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d';
ERROR:  invalid input syntax for integer: "
"
CONTEXT:  COPY test_ud_eol, line 4, column id: "
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0a';
ERROR:  value too long for type character(100)
CONTEXT:  COPY test_ud_eol, line 1, column name: "zhangsan                                                                                            
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d0a';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

--2 test 0x0d
copy test_ud_eol to '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0a';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d0a';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

--3 test 0x0a
copy test_ud_eol to '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0a';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d0a';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '0x0d';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '0x0a';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

--4 test \r\n
copy test_ud_eol to '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\r\n';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '\r';
ERROR:  invalid input syntax for integer: "
"
CONTEXT:  COPY test_ud_eol, line 4, column id: "
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\n';
ERROR:  value too long for type character(100)
CONTEXT:  COPY test_ud_eol, line 1, column name: "zhangsan                                                                                            
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\r\n';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

--5 test \r
copy test_ud_eol to '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\r';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\n';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\r\n';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\r';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

--6 test \n
copy test_ud_eol to '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\n';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\r\n';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\r';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            
2	lisi                                                                                                
3	wangwu                                                                                              
"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/tmp_check/datanode1/pg_copydir/test_ud_eol.txt' eol '\n';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

--7 test $
copy test_ud_eol to '@abs_srcdir@/data/test_ud_eol.txt' eol '$';
truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt';
ERROR:  extra data after last expected column
CONTEXT:  COPY test_ud_eol, line 1: "1	zhangsan                                                                                            $2	lisi                                                                                                $3	wangwu                                                                                              $"
select * from test_ud_eol order by id;
 id | name 
----+------
(0 rows)

truncate table test_ud_eol;
copy test_ud_eol from '@abs_srcdir@/data/test_ud_eol.txt' eol '$';
select * from test_ud_eol order by id;
 id |                                                 name                                                 
----+------------------------------------------------------------------------------------------------------
  1 | zhangsan                                                                                            
  2 | lisi                                                                                                
  3 | wangwu                                                                                              
(3 rows)

drop table test_ud_eol;