[英]How to batch load data with psql with different encodings?
I have a UTF8 database and a UTF8 script to fill tables with data. 我有一个UTF8数据库和一个UTF8脚本来用数据填充表。 However I want to run this script with psql -d instance -U user -f fillTables.sql
. 但是我想使用psql -d instance -U user -f fillTables.sql
运行此脚本。 As my system has a Windows CP1252 encoding it looks like psql uses this to parse the file. 由于我的系统具有Windows CP1252编码,因此psql似乎使用它来解析文件。 I found this documentation and saw these backslash commands, but don't get it working 我找到了本文档,并看到了这些反斜杠命令,但没有使它起作用
psql \encoding UTF8 -d instance -U user -f fillTables.sql
It looks like these are meant for starting psql and entering commands inside the psql console, right? 看起来这些是用于启动psql并在psql控制台内输入命令的,对吧? How can I set different encoding for a batch processing of different files? 如何为不同文件的批处理设置不同的编码?
我将其与export PGCLIENTENCODING=UTF8
(在cygwin中,Windows有另一种语法),但是如果它们可以使用psql选项实现相同的功能,则可以接受其他答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.