Skip to content

Commit 6f65678

Browse files
committed
Make text octet_length() return non-compressed length to be consistent
with other data types, per disucssion. Encoding issue still open.
1 parent 9473f8d commit 6f65678

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/backend/utils/adt/varlena.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.76 2001/11/19 09:05:02 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.77 2001/11/19 18:21:10 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -256,20 +256,13 @@ textlen(PG_FUNCTION_ARGS)
256256
* textoctetlen -
257257
* returns the physical length of a text*
258258
* (which is less than the VARSIZE of the text*)
259-
*
260-
* XXX is it actually appropriate to return the compressed length
261-
* when the value is compressed? It's not at all clear to me that
262-
* this is what SQL92 has in mind ...
263259
*/
264260
Datum
265261
textoctetlen(PG_FUNCTION_ARGS)
266262
{
267-
struct varattrib *t = (struct varattrib *) PG_GETARG_RAW_VARLENA_P(0);
268-
269-
if (!VARATT_IS_EXTERNAL(t))
270-
PG_RETURN_INT32(VARATT_SIZE(t) - VARHDRSZ);
263+
text *arg = PG_GETARG_VARCHAR_P(0);
271264

272-
PG_RETURN_INT32(t->va_content.va_external.va_extsize);
265+
PG_RETURN_INT32(VARSIZE(arg) - VARHDRSZ);
273266
}
274267

275268
/*

0 commit comments

Comments
 (0)