简体   繁体   English

如何使用带有不同编码的psql批量加载数据?

[英]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.

相关问题 如何将时间差从 psql 加载到谷歌数据工作室 - How to load time difference from psql to google data studio 如何将 Find 的 output 排序到 psql 复制命令以按顺序加载数据? - How to sort the output of Find to a psql copy command to load data in order? 如何也将JSON文件加载到PSQL数据库 - How to load the JSON file too the PSQL database 如何将数据从CSV转储复制到具有不同结构的PSQL数据库中? - How do I copy data from a CSV dump into a PSQL database with a different structure? 如何在Psql中的不同数据库下创建表 - How to create a table under different Databases in Psql psql 版本因您的检查方式而异 - psql version different depending on how you check it 如何定期从psql表中获取数据 - How to periodically fetch data from psql table 在使用SQLAlchemy的Flask Web应用程序中,当显示来自大型PSQL数据库的数据时如何改善页面加载时间? - In a Flask web app using SQLAlchemy, how do I improve page load times when displaying data from a large PSQL database? 通过在PSQL中进行修改将数据从列插入到另一个不同的表列 - Insert data from column to another different table column with modifying in PSQL 如何连接到同一网络上但在不同计算机上运行的 PSQL 数据库 - How to connect to a PSQL database on the same network but running on a different computer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM