我正在尝试使用 pg_bulkload 13 将一些数据插入到 Postgres db。但是,我遇到了一些由双引号 ("") 引用到时间戳字段的空(null)值的问题。如果字段类型是字符,则没有问题。您能帮忙解决以下问题吗?
- 输入文件。第一条记录插入成功,但第二条记录被解析。
record #1 --
85,"dgadga","",,,"2021-04-01 05:53:29"
record #2 ---troubled record
85,"dgadga","",,,""
- 表结构。
c_id integer,
c_name character(20) COLLATE pg_catalog."default",
dt character(10) COLLATE pg_catalog."default",
ds character(10) COLLATE pg_catalog."default",
dt1 date,
dt2 timestamp without time zone
- pg_bulkload 日志
INPUT = stdin
PARSE_BADFILE = /var/lib/pgsql/13/data/pg_bulkload/20210421160309_postgres_test.prs
LOGFILE = /var/lib/pgsql/13/data/pg_bulkload/20210421160309_postgres_test.log
LIMIT = INFINITE
PARSE_ERRORS = 0
ENCODING = UTF8
CHECK_CONSTRAINTS = NO
TYPE = CSV
SKIP = 0
DELIMITER = ,
QUOTE = "\""
ESCAPE = "\""
NULL =
OUTPUT =test
MULTI_PROCESS = NO
VERBOSE = NO
WRITER = DIRECT
DUPLICATE_BADFILE = /var/lib/pgsql/13/data/pg_bulkload/20210421160309_postgres_test.dup.csv
DUPLICATE_ERRORS = 0
ON_DUPLICATE_KEEP = NEW
TRUNCATE = NO
Parse error Record 1: Input Record 2: Rejected - column 6. invalid input syntax for type timestamp: ""
Maximum parse error count exceeded - 1 error(s) found in input file
0 Rows skipped.
1 Rows successfully loaded.
1 Rows not loaded due to parse errors.
0 Rows not loaded due to duplicate errors.
0 Rows replaced with new rows.