OSDN Git Service

Close previously open holes for invalidly encoded data to enter the
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 18 Sep 2007 17:41:17 +0000 (17:41 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 18 Sep 2007 17:41:17 +0000 (17:41 +0000)
commit55613bf9cd7d6071e43e68ac14bc0243a1027507
tree9b151f94d94e7dc3aa5988c03867d3f6f6b562ba
parent8544110042ddf8be29e177e37f53516686a06da2
Close previously open holes for invalidly encoded data to enter the
database via builtin functions, as recently discussed on -hackers.

chr() now returns a character in the database encoding. For UTF8 encoded databases
the argument is treated as a Unicode code point. For other multi-byte encodings
the argument must designate a strict ascii character, or an error is raised,
as is also the case if the argument is 0.

ascii() is adjusted so that it remains the inverse of chr().

The two argument form of convert() is gone, and the three argument form now
takes a bytea first argument and returns a bytea. To cover this loss three new
functions are introduced:
. convert_from(bytea, name) returns text - converts the first argument from the
  named encoding to the database encoding
. convert_to(text, name) returns bytea - converts the first argument from the
  database encoding to the named encoding
. length(bytea, name) returns int - gives the length of the first argument in
  characters in the named encoding
doc/src/sgml/func.sgml
src/backend/catalog/pg_conversion.c
src/backend/utils/adt/oracle_compat.c
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/wchar.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/mb/pg_wchar.h
src/include/utils/builtins.h