diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2009-07-07 18:23:15 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2009-07-07 18:23:15 +0000 |
commit | e292dbcf543183fa6eae98c377b3939d08794676 (patch) | |
tree | f00e066652378c783019966de30fc224cb0a41ec /src/backend/utils/mb/mbutils.c | |
parent | 788d8e513953b580de8b93543d963d28009b031d (diff) | |
download | postgresql-e292dbcf543183fa6eae98c377b3939d08794676.tar.gz postgresql-e292dbcf543183fa6eae98c377b3939d08794676.zip |
More sensible character_octet_length
For character types with typmod, character_octet_length columns in the
information schema now show the maximum character length times the
maximum length of a character in the server encoding, instead of some
huge value as before.
Diffstat (limited to 'src/backend/utils/mb/mbutils.c')
-rw-r--r-- | src/backend/utils/mb/mbutils.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c index 9a739019531..fe8941b3c02 100644 --- a/src/backend/utils/mb/mbutils.c +++ b/src/backend/utils/mb/mbutils.c @@ -4,7 +4,7 @@ * * Tatsuo Ishii * - * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.87 2009/06/11 14:49:05 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.88 2009/07/07 18:23:14 petere Exp $ */ #include "postgres.h" @@ -482,6 +482,17 @@ length_in_encoding(PG_FUNCTION_ARGS) } +Datum +pg_encoding_max_length_sql(PG_FUNCTION_ARGS) +{ + int encoding = PG_GETARG_INT32(0); + + if (PG_VALID_ENCODING(encoding)) + return pg_wchar_table[encoding].maxmblen; + else + PG_RETURN_NULL(); +} + /* * convert client encoding to server encoding. */ |