blob: 1b3bd74684f8f4b3d2e9591cbe14db8cde56041d [file] [log] [blame]
set datestyle = 'ISO, DMY';
-- Using double quote for source file location
-- system correctly fails the create operation
-- and shows the correct syntax error message
DROP EXTERNAL TABLE IF EXISTS tbl_ext_fixedwidth;
CREATE READABLE EXTERNAL TABLE tbl_ext_fixedwidth (
s1 char(10), s2 varchar(10), s3 text, dt timestamp,
n1 smallint, n2 integer, n3 bigint, n4 decimal,
n5 numeric, n6 real, n7 double precision)
LOCATION ("file://path/doesnt/path/doesnt/matter.tbl")
FORMAT 'CUSTOM' (formatter='fixedwidth_in', s1='10',
s2='10', s3='10', dt='20',n1='5', n2='10',
n3='10', n4='10', n5='10', n6='10', n7='15');
ERROR: syntax error at or near ""file://path/doesnt/path/doesnt/matter.tbl""
LINE 5: LOCATION ("file://path/doesnt/path/doesnt/matter.tbl")
^
-- Using double quote for CUSTOM format keyword
-- system correctly fails the create operation
-- and shows the correct syntax error message
DROP EXTERNAL TABLE IF EXISTS tbl_ext_fixedwidth;
NOTICE: foreign table "tbl_ext_fixedwidth" does not exist, skipping
CREATE READABLE EXTERNAL TABLE tbl_ext_fixedwidth (
s1 char(10), s2 varchar(10), s3 text, dt timestamp,
n1 smallint, n2 integer, n3 bigint, n4 decimal,
n5 numeric, n6 real, n7 double precision)
LOCATION ('file://@hostname@@abs_srcdir@/data/fixedwidth_small_correct.tbl')
FORMAT "CUSTOM" (formatter='fixedwidth_in', s1='10',
s2='10', s3='10', dt='20',n1='5', n2='10',
n3='10', n4='10', n5='10', n6='10', n7='15');
ERROR: syntax error at or near ""CUSTOM""
LINE 6: FORMAT "CUSTOM" (formatter='fixedwidth_in', s1='10',
^
-- Can successfully create the external table
-- with values in Field Locations doubled quoted
DROP EXTERNAL TABLE IF EXISTS tbl_ext_fixedwidth;
NOTICE: foreign table "tbl_ext_fixedwidth" does not exist, skipping
CREATE READABLE EXTERNAL TABLE tbl_ext_fixedwidth (
s1 char(10), s2 varchar(10), s3 text, dt timestamp,
n1 smallint, n2 integer, n3 bigint, n4 decimal,
n5 numeric, n6 real, n7 double precision)
LOCATION ('file://@hostname@@abs_srcdir@/data/fixedwidth_small_correct.tbl')
FORMAT 'CUSTOM' (formatter="fixedwidth_in", s1="10",
s2="10", s3="10", dt="20",n1="5", n2="10",
n3="10", n4="10", n5="10", n6="10", n7="15");
SELECT * FROM tbl_ext_fixedwidth ORDER BY s1;
s1 | s2 | s3 | dt | n1 | n2 | n3 | n4 | n5 | n6 | n7
------------+------+--------+---------------------+----+-----+--------+-------+---------+---------+------------
aaa | twoa | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
bbb | twob | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
ccc | twoc | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
ddd | twod | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
eee | twoe | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
fff | twof | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
ggg | twog | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
hhh | twoh | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
iii | twoi | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
jjj | twoj | shpits | 2011-06-01 12:30:30 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789
(10 rows)