Skip site navigation (1) Skip section navigation (2)

Re: psql crashes on encoding mismatch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql crashes on encoding mismatch
Date: 2011-01-13 05:22:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
> I found a crash case (assertion failure) when runing psql -f
> utf8_encoded_script.sql against client_encoding = shift_jis in
> postgresql.conf. Though encoding mismatch is obviously user's fault, a
> crash doesn't explain anything to him.

I'm not too impressed with this patch: it seems like the most it will
accomplish is to move the failure to some other, equally obscure, place
--- because you'll still have a string that's invalidly encoded.
Moreover, if you've got wrongly encoded data, it wouldn't be hard at all
for it to mess up psql's lexing; consider cases such as a
character-that's-not-as-long-as-we-think just in front of a quote mark.

Shouldn't we instead try to verify the multibyte encoding somewhere
upstream of here?

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: KaiGai KoheiDate: 2011-01-13 06:10:45
Subject: Re: sepgsql contrib module
Previous:From: Tom LaneDate: 2011-01-13 05:12:47
Subject: Re: arrays as pl/perl input arguments [PATCH]

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group