Re: psql crashes on encoding mismatch - Mailing list pgsql-hackers

From Tom Lane
Subject Re: psql crashes on encoding mismatch
Date
Msg-id 9418.1294896152@sss.pgh.pa.us
Whole thread Raw
In response to psql crashes on encoding mismatch  (Hitoshi Harada <umi.tanuki@gmail.com>)
Responses Re: psql crashes on encoding mismatch  (Hitoshi Harada <umi.tanuki@gmail.com>)
List pgsql-hackers
Hitoshi Harada <umi.tanuki@gmail.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: arrays as pl/perl input arguments [PATCH]
Next
From: KaiGai Kohei
Date:
Subject: Re: sepgsql contrib module