1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Make text octet_length() return non-compressed length to be consistent

with other data types, per disucssion.  Encoding issue still open.
This commit is contained in:
Bruce Momjian
2001-11-19 18:21:10 +00:00
parent 9473f8d5f7
commit 6f6567812e

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.76 2001/11/19 09:05:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.77 2001/11/19 18:21:10 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -256,20 +256,13 @@ textlen(PG_FUNCTION_ARGS)
* textoctetlen - * textoctetlen -
* returns the physical length of a text* * returns the physical length of a text*
* (which is less than the VARSIZE of the text*) * (which is less than the VARSIZE of the text*)
*
* XXX is it actually appropriate to return the compressed length
* when the value is compressed? It's not at all clear to me that
* this is what SQL92 has in mind ...
*/ */
Datum Datum
textoctetlen(PG_FUNCTION_ARGS) textoctetlen(PG_FUNCTION_ARGS)
{ {
struct varattrib *t = (struct varattrib *) PG_GETARG_RAW_VARLENA_P(0); text *arg = PG_GETARG_VARCHAR_P(0);
if (!VARATT_IS_EXTERNAL(t)) PG_RETURN_INT32(VARSIZE(arg) - VARHDRSZ);
PG_RETURN_INT32(VARATT_SIZE(t) - VARHDRSZ);
PG_RETURN_INT32(t->va_content.va_external.va_extsize);
} }
/* /*