mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Add missing Datum conversions
Add various missing conversions from and to Datum. The previous code mostly relied on implicit conversions or its own explicit casts instead of using the correct DatumGet*() or *GetDatum() functions. We think these omissions are harmless. Some actual bugs that were discovered during this process have been committed separately (80c758a2e1,fd2ab03fea). Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org
This commit is contained in:
@@ -299,9 +299,9 @@ datum_image_eq(Datum value1, Datum value2, bool typByVal, int typLen)
|
||||
len1 - VARHDRSZ) == 0);
|
||||
|
||||
/* Only free memory if it's a copy made here. */
|
||||
if ((Pointer) arg1val != (Pointer) value1)
|
||||
if ((Pointer) arg1val != DatumGetPointer(value1))
|
||||
pfree(arg1val);
|
||||
if ((Pointer) arg2val != (Pointer) value2)
|
||||
if ((Pointer) arg2val != DatumGetPointer(value2))
|
||||
pfree(arg2val);
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,7 @@ datum_image_hash(Datum value, bool typByVal, int typLen)
|
||||
result = hash_bytes((unsigned char *) VARDATA_ANY(val), len - VARHDRSZ);
|
||||
|
||||
/* Only free memory if it's a copy made here. */
|
||||
if ((Pointer) val != (Pointer) value)
|
||||
if ((Pointer) val != DatumGetPointer(value))
|
||||
pfree(val);
|
||||
}
|
||||
else if (typLen == -2)
|
||||
|
||||
Reference in New Issue
Block a user