Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ba1c463

Browse files
committed
Clean up a few places where Datums were being treated as pointers without
going through DatumGetPointer or some other "official" conversion macro. Not actually a bug, since Datum the same size as pointer is the only supported case at the moment, but good cleanup for the future. Gavin Sherry
1 parent ec498cd commit ba1c463

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/backend/utils/adt/varlena.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.164 2008/03/25 22:42:44 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.165 2008/04/12 23:21:04 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -754,7 +754,8 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
754754
* If we're working with an untoasted source, no need to do an extra
755755
* copying step.
756756
*/
757-
if (VARATT_IS_COMPRESSED(str) || VARATT_IS_EXTERNAL(str))
757+
if (VARATT_IS_COMPRESSED(DatumGetPointer(str)) ||
758+
VARATT_IS_EXTERNAL(DatumGetPointer(str)))
758759
slice = DatumGetTextPSlice(str, slice_start, slice_size);
759760
else
760761
slice = (text *) DatumGetPointer(str);

src/backend/utils/mb/mbutils.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (currently mule internal code (mic) is used)
55
* Tatsuo Ishii
66
*
7-
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.69 2008/01/09 23:43:54 tgl Exp $
7+
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.70 2008/04/12 23:21:04 tgl Exp $
88
*/
99
#include "postgres.h"
1010

@@ -313,7 +313,7 @@ pg_convert_to(PG_FUNCTION_ARGS)
313313
result = DirectFunctionCall3(pg_convert, string,
314314
src_encoding_name, dest_encoding_name);
315315

316-
PG_RETURN_BYTEA_P(result);
316+
PG_RETURN_DATUM(result);
317317
}
318318

319319
/*
@@ -340,7 +340,7 @@ pg_convert_from(PG_FUNCTION_ARGS)
340340
* in this case it will be because we've told pg_convert to return one
341341
* that is valid as text in the current database encoding.
342342
*/
343-
PG_RETURN_TEXT_P(result);
343+
PG_RETURN_DATUM(result);
344344
}
345345

346346
/*

0 commit comments

Comments
 (0)