1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

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.
This commit is contained in:
Peter Eisentraut
2009-07-07 18:23:15 +00:00
parent 788d8e5139
commit e292dbcf54
6 changed files with 37 additions and 18 deletions

View File

@@ -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.
*/