summaryrefslogtreecommitdiff
path: root/src/test/regress/output/xl_bugs.source
blob: ad15fb3aa51273605d2b8f8d20322c7768c6dda9 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--
-- XC_COPY
--
-- COPY tests for a Postgres-XL cluster
create or replace function pgxc_nodetype() returns varchar as 
$$
declare
	pgxc_class_entries int;        
begin
	select into pgxc_class_entries count(*) from pgxc_class ;             
	if pgxc_class_entries > 0 then
		return ' Node type: C';
	else
		return ' Node type: D';
	end if;
end $$ language plpgsql;
create function deffunc() returns bytea as
$$
begin
	return E'\\023\\000\\\\''!|''';
end $$ language plpgsql;
create or replace function deffunc_bytea() returns bytea as 
$$
begin
	return E'\0123';
end $$ language plpgsql;
create or replace function deffunc_str() returns varchar as 
$$
begin
	return E'\\.\\000"\\''!|''\\N' || pgxc_nodetype();
end $$ language plpgsql;
create or replace function deffunc_str_i() returns varchar immutable as 
$$
begin
	return E'\\.\\000"\\''!|''' || pgxc_nodetype();
end $$ language plpgsql;
create or replace function deffunc_nullstring() returns varchar as 
$$
begin
	return E'\\N';
end $$ language plpgsql;
create table xccopydef(idseq serial, id1 int,
                       def1 bytea default deffunc(),
					   def2 bytea default E'\\000'::bytea,
					   def3 varchar default deffunc_str(),
					   def4 varchar default deffunc_str_i(),
					   def5 varchar default deffunc_nullstring(),
					   def6 bytea default deffunc_bytea(),
					   id2 varchar,
					   def7 float default length(deffunc_str()) + 0.433);
copy xccopydef (id1, id2) from stdin (delimiter '|');
copy xccopydef (id1, id2) from stdin (format 'csv');
insert into xccopydef (id1, id2) values (NULL, NULL);
insert into xccopydef (id1) values (4567);
select * from xccopydef order by idseq;
 idseq | id1  |       def1       | def2 |            def3             |           def4            | def5 |  def6  |    id2    |  def7  
-------+------+------------------+------+-----------------------------+---------------------------+------+--------+-----------+--------
     1 |    3 | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  \\x135   | 27.433
     2 |      | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  abcd     | 27.433
     3 |    3 | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  \\\\x135 | 27.433
     4 |      | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  abcd     | 27.433
     5 |      | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: C | \N   | \x0a33 |           | 27.433
     6 | 4567 | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: C | \N   | \x0a33 |           | 27.433
(6 rows)

copy xccopydef (id1, id2) to '@abs_builddir@/results/copydefout.data' (format 'binary');
truncate xccopydef;
copy xccopydef (id1, id2) from '@abs_builddir@/results/copydefout.data' (format 'binary');
select * from xccopydef order by idseq;
 idseq | id1  |       def1       | def2 |            def3             |           def4            | def5 |  def6  |    id2    |  def7  
-------+------+------------------+------+-----------------------------+---------------------------+------+--------+-----------+--------
     7 |    3 | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  \\x135   | 27.433
     8 |      | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  abcd     | 27.433
     9 |    3 | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  \\\\x135 | 27.433
    10 |      | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |  abcd     | 27.433
    11 |      | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |           | 27.433
    12 | 4567 | \x13005c27217c27 | \x00 | \.\000"\'!|'\N Node type: C | \.\000"\'!|' Node type: D | \N   | \x0a33 |           | 27.433
(6 rows)

drop table xccopydef;
drop function pgxc_nodetype();
drop function deffunc();
drop function deffunc_bytea();
drop function deffunc_str();
drop function deffunc_str_i();
drop function deffunc_nullstring();