From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Plug some more holes in encoding conversion. |
Date: | 2014-02-23 20:22:57 |
Message-ID: | E1WHfZh-0000sp-Jb@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Plug some more holes in encoding conversion.
Various places assume that pg_do_encoding_conversion() and
pg_server_to_any() will ensure encoding validity of their results;
but they failed to do so in the case that the source encoding is SQL_ASCII
while the destination is not. We cannot perform any actual "conversion"
in that scenario, but we should still validate the string according to the
destination encoding. Per bug #9210 from Digoal Zhou.
Arguably this is a back-patchable bug fix, but on the other hand adding
more enforcing of encoding checks might break existing applications that
were being sloppy. On balance there doesn't seem to be much enthusiasm
for a back-patch, so fix in HEAD only.
While at it, remove some apparently-no-longer-needed provisions for
letting pg_do_encoding_conversion() "work" outside a transaction ---
if you consider it "working" to silently fail to do the requested
conversion.
Also, make a few cosmetic improvements in mbutils.c, notably removing
some Asserts that are certainly dead code since the variables they
assert aren't null are never null, even at process start. (I think
this wasn't true at one time, but it is now.)
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/49c817eab78c6f0ce8c3bf46766b73d6cf3190b7
Modified Files
--------------
src/backend/utils/mb/mbutils.c | 205 +++++++++++++++++++++++-----------------
1 file changed, 117 insertions(+), 88 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-02-23 21:59:16 | pgsql: Prefer pg_any_to_server/pg_server_to_any over pg_do_encoding_con |
Previous Message | Peter Eisentraut | 2014-02-23 01:44:33 | pgsql: configure.in: Use dnl in place of # where appropriate |