diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2007-09-18 17:41:17 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2007-09-18 17:41:17 +0000 |
commit | 55613bf9cd7d6071e43e68ac14bc0243a1027507 (patch) | |
tree | 9b151f94d94e7dc3aa5988c03867d3f6f6b562ba /src/include/utils/builtins.h | |
parent | 8544110042ddf8be29e177e37f53516686a06da2 (diff) | |
download | postgresql-55613bf9cd7d6071e43e68ac14bc0243a1027507.tar.gz postgresql-55613bf9cd7d6071e43e68ac14bc0243a1027507.zip |
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
Diffstat (limited to 'src/include/utils/builtins.h')
-rw-r--r-- | src/include/utils/builtins.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 5d581b6ea5c..c1610f320f5 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.302 2007/09/04 16:41:43 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.303 2007/09/18 17:41:17 adunstan Exp $ * *------------------------------------------------------------------------- */ @@ -902,7 +902,9 @@ extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS); extern Datum PG_character_set_name(PG_FUNCTION_ARGS); extern Datum PG_character_set_id(PG_FUNCTION_ARGS); extern Datum pg_convert(PG_FUNCTION_ARGS); -extern Datum pg_convert2(PG_FUNCTION_ARGS); +extern Datum pg_convert_to(PG_FUNCTION_ARGS); +extern Datum pg_convert_from(PG_FUNCTION_ARGS); +extern Datum length_in_encoding(PG_FUNCTION_ARGS); /* format_type.c */ extern Datum format_type(PG_FUNCTION_ARGS); |