原 PG导入数据报错error: invalid command \N的排错方法:“-v ON_ERROR_STOPP=1”的使用
Tags: 原创故障处理invalid commandON_ERROR_STOPP
简介
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 | [pg15@pg15 ~]$ psql -d "postgres://postgres:lhr@192.16.7.162:5532/db2" -f d_dept.dump SET SET SET SET SET set_config ------------ (1 row) SET SET SET SET SET SET psql:d_dept.dump:78: ERROR: collation "pg_catalog.zh_CN" for encoding "UTF8" does not exist LINE 8: dept_name text COLLATE pg_catalog."zh_CN", ^ psql:d_dept.dump:81: ERROR: relation "odr60.d_dept" does not exist psql:d_dept.dump:87: ERROR: relation "odr60.d_dept" does not exist .... psql:d_dept.dump:445: error: invalid command \N psql:d_dept.dump:446: error: invalid command \N psql:d_dept.dump:447: error: invalid command \N psql:d_dept.dump:448: error: invalid command \N ...... |
排错
可以开启-v ON_ERROR_STOPP=1
,看看会有哪些错误,该参数表示在遇到第一个错误的时候就会停止。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | [pg15@pg15 ~]$ psql -d "postgres://postgres:lhr@192.16.7.162:5532/db2" -f d_dept.dump -v ON_ERROR_STOP=1 SET SET SET SET SET set_config ------------ (1 row) SET SET SET SET SET SET psql:d_dept.dump:78: ERROR: collation "pg_catalog.zh_CN" for encoding "UTF8" does not exist LINE 8: dept_name text COLLATE pg_catalog."zh_CN", ^ |