简体   繁体   中英

How to batch load data with psql with different encodings?

I have a UTF8 database and a UTF8 script to fill tables with data. However I want to run this script with 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. 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? How can I set different encoding for a batch processing of different files?

我将其与export PGCLIENTENCODING=UTF8 (在cygwin中,Windows有另一种语法),但是如果它们可以使用psql选项实现相同的功能,则可以接受其他答案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM