blob: bb0ef5510cc20b219aea30508eb045cabba73343 [file] [log] [blame]
-- When field length of s1 is 10, which is less than its defined column length char(20)
DROP EXTERNAL TABLE IF EXISTS tbl_ext_fixedwidth;
CREATE READABLE EXTERNAL TABLE tbl_ext_fixedwidth (
s1 char(20), s2 varchar(20), s3 text,
col_empty character(5),col_null character varying(5) )
LOCATION ('file://@hostname@@abs_srcdir@/data/fixedwidth_null.tbl')
FORMAT 'CUSTOM' (formatter='fixedwidth_in',
s1='10',s2='10', s3='10', col_empty='5', col_null='5');
-- query ext table can return correct results
select * from tbl_ext_fixedwidth;
s1 | s2 | s3 | col_empty | col_null
----------------------+-----------+------------+-----------+----------
cha | vara | texta | | null
chb | varb | textb | | NULL
chc | varc | textc | | Null
chd | vard | textd | | NULLL
che | vare | texte | |
chf | varf | textf | | null
chg | varg | textg | | NULLa
chh | varh | texth | | NULL_
chi | vari | texti | | null
chj | varj | textj | | aNULL
(10 rows)
-- When field length of s1 is 10, which is greater than its defined column length char(5)
DROP EXTERNAL TABLE IF EXISTS tbl_ext_fixedwidth;
CREATE READABLE EXTERNAL TABLE tbl_ext_fixedwidth (
s1 char(5), s2 varchar(5), s3 text,
col_empty character(5),col_null character varying(5) )
LOCATION ('file://@hostname@@abs_srcdir@/data/fixedwidth_null.tbl')
FORMAT 'CUSTOM' (formatter='fixedwidth_in',
s1='10',s2='10', s3='10', col_empty='5', col_null='5');
-- query ext table correctly show the error message
select * from tbl_ext_fixedwidth order by s1;
ERROR: value too long for type character varying(5) (seg0 slice1 rh55-qavm55:7532 pid=23646)
CONTEXT: External table tbl_ext_fixedwidth