Re: [HACKERS] fatal copy in/out error (6.5.3) - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: [HACKERS] fatal copy in/out error (6.5.3)
Date
Msg-id 20000125140004W.t-ishii@sra.co.jp
Whole thread Raw
In response to Re: [HACKERS] fatal copy in/out error (6.5.3)  (Michael Robinson <robinson@netrinsics.com>)
Responses Re: [HACKERS] fatal copy in/out error (6.5.3)
List pgsql-hackers
> It could be that one of our users had their input method set to produce
> EUC_TW or Big5.
>
> >In short, the problem you have is caused by:
> >1) wrong data submitted into the table
> 
> Kind of hard to control that when data is submitted by random users on
> the Internet.

Yes, it's not a PostgreSQL's business but is a really big problem in
the real world. Maybe some HTML gurus might have good suggestions on
these issues (something like using a language tag?)

> >I would recommend you delete the data since it's not correct anyway.
> >In the mean time I'm going to fix 2) so that it assumes data be
> >consisted of 2 bytes even if wrong data sequence is submitted
> >(needless to say, except ascii).
> >Do you want the backpatch for 6.5.3?
> 
> Very much so.  Thank you.

Here it is. With this patch, copy out should be happy even with the
wrong data. I'm not sure if it could be displayed correctly, though.
--
Tatsuo Ishii
------------------------------- cut here ------------------------------------
*** postgresql-6.5.3/src/backend/utils/mb/wchar.c.orig    Tue Jan 25 13:37:21 2000
--- postgresql-6.5.3/src/backend/utils/mb/wchar.c    Tue Jan 25 13:37:33 2000
***************
*** 166,176 **** {     int            len; 
!     if (*s == SS2)
!         len = 3;
!     else if (*s == SS3)
!         len = 3;
!     else if (*s & 0x80)         len = 2;     else         len = 1;
--- 166,172 ---- {     int            len; 
!     if (*s & 0x80)         len = 2;     else         len = 1;


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Happy column dropping
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace