Re: [HACKERS] [BUGS] BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding

2014-02-19 Thread Tom Lane
I wrote: The minimum-refactoring solution to this would be to tweak pg_do_encoding_conversion() so that if the src_encoding is SQL_ASCII but the dest_encoding isn't, it does pg_verify_mbstr() rather than nothing. I'm not sure if this would break anything we need to have work, though.

Re: [HACKERS] [BUGS] BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding

2014-02-18 Thread Tom Lane
I wrote: dig...@126.com writes: select t, t::bytea from convert_from('\xeec1', 'sql_ascii') as g(t); [ fails to check that string is valid in database encoding ] Hm, yeah. Normal input to the database goes through pg_any_to_server(), which will apply a validation step if the source encoding

Re: [HACKERS] [BUGS] BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding

2014-02-18 Thread Tom Lane
I wrote: I looked through all the callers of pg_do_encoding_conversion(), and AFAICS this change is a good idea. There are a whole bunch of places that use pg_do_encoding_conversion() to convert from the database encoding to encoding X (most usually UTF8), and right now if you do that in a

Re: [HACKERS] [BUGS] BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding

2014-02-13 Thread Tom Lane
dig...@126.com writes: select t, t::bytea from convert_from('\xeec1', 'sql_ascii') as g(t); [ fails to check that string is valid in database encoding ] Hm, yeah. Normal input to the database goes through pg_any_to_server(), which will apply a validation step if the source encoding is