From e292dbcf543183fa6eae98c377b3939d08794676 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 7 Jul 2009 18:23:15 +0000 Subject: 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. --- src/backend/utils/mb/mbutils.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/mb/mbutils.c') 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. */ -- cgit v1.2.3