Thread: pgsql: Add ENCODING option to COPY TO/FROM and file_fdw.
Add ENCODING option to COPY TO/FROM and file_fdw. File encodings can be specified separately from client encoding. If not specified, client encoding is used for backward compatibility. Cases when the encoding doesn't match client encoding are slower than matched cases because we don't have conversion procs for other encodings. Performance improvement would be be a future work. Original patch by Hitoshi Harada, and modified by me. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/3cba8240a195c4f323e3f934bfeab308434a9973 Modified Files -------------- contrib/file_fdw/file_fdw.c | 1 + doc/src/sgml/file-fdw.sgml | 11 ++++++ doc/src/sgml/ref/copy.sgml | 20 ++++++++++-- src/backend/commands/copy.c | 60 +++++++++++++++++++++++----------- src/backend/parser/gram.y | 4 ++ src/backend/utils/mb/mbutils.c | 46 ++++++++++++++++++++++----- src/include/mb/pg_wchar.h | 2 + src/test/regress/expected/copy2.out | 6 ++-- src/test/regress/sql/copy2.sql | 6 ++-- 9 files changed, 119 insertions(+), 37 deletions(-)
Itagaki Takahiro <itagaki.takahiro@gmail.com> writes: > Add ENCODING option to COPY TO/FROM and file_fdw. > File encodings can be specified separately from client encoding. > If not specified, client encoding is used for backward compatibility. The buildfarm thinks this patch broke contrib/unaccent. regards, tom lane
On Mon, Feb 21, 2011 at 15:12, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Itagaki Takahiro <itagaki.takahiro@gmail.com> writes: >> Add ENCODING option to COPY TO/FROM and file_fdw. >> File encodings can be specified separately from client encoding. >> If not specified, client encoding is used for backward compatibility. > > The buildfarm thinks this patch broke contrib/unaccent. It was my silly bug. Fixed. -- Itagaki Takahiro