My colleague and I have found about this in PostgreSQL source code, but we’re not so sure.
Thanks for your reply!
Regards!
Jasmine Liu
发件人: Andreas Joseph Krogh-2 [via PostgreSQL] [mailto:[hidden email]] 发送时间: 2014年8月28日 20:46 收件人: JasmineLiu 主题: Re: invalid byte sequence for encoding "UTF8": 0x00
På onsdag 27. august 2014 kl. 10:11:09, skrev Albe Laurenz <[hidden email]>:
JasmineLiu wrote: > I've also got this problem while copy or insert data from MS SQL Server to > PostgreSQL. > SQLServer 2008 R2, encoding :GBK > PostgreSQL 9.3.4, encoding:UTF8 > > Rather than modify the column value in sql server, > are there any other ways to solve this problem? > Better to give me an examples.
You will never be able to insert a null character into a PostgreSQL database. You can either modify the source data or change the data in transit.
This is not 100% true, but is true for text-fields. You can insert \0 into BYTEA columns.
Usually the \0 isn't important so you can do this in JAVA before inserting into PG:
someString.replace('\0', ' ') or someString.replaceAll("\0", "")