mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
Use more appropriate DatumGet* function
Use DatumGetCString() instead of DatumGetPointer() for returning a C string. Right now, they are the same, but that doesn't always have to be so. Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org
This commit is contained in:
@@ -35,13 +35,13 @@ static const ResourceOwnerDesc string_desc = {
|
||||
static void
|
||||
ReleaseString(Datum res)
|
||||
{
|
||||
elog(NOTICE, "releasing string: %s", DatumGetPointer(res));
|
||||
elog(NOTICE, "releasing string: %s", DatumGetCString(res));
|
||||
}
|
||||
|
||||
static char *
|
||||
PrintString(Datum res)
|
||||
{
|
||||
return psprintf("test string \"%s\"", DatumGetPointer(res));
|
||||
return psprintf("test string \"%s\"", DatumGetCString(res));
|
||||
}
|
||||
|
||||
/* demonstrates phases and priorities between a parent and child context */
|
||||
|
||||
Reference in New Issue
Block a user