All Products
Search
Document Center

ApsaraDB RDS:ST_SetMD5Sum

Last Updated:Mar 28, 2026

Sets the MD5 hash string in the metadata of a raster object.

Syntax

text ST_SetMD5Sum(raster raster_obj, text md5sum)

Parameters

ParameterDescription
raster_objThe name of the raster object.
md5sumThe MD5 hash string to assign to the raster object. Must be 32 characters and contain only digits and lowercase letters.

Description

ST_SetMD5Sum writes an MD5 hash string to the metadata of a raster object. The hash string must be exactly 32 characters and can contain only digits and lowercase letters.

To automatically calculate and store an MD5 hash string when a raster object is saved, set the ganos.raster.calculate_md5 database parameter:

ParameterTypeDescription
ganos.raster.calculate_md5booleanSpecifies whether to calculate the MD5 hash string and saves it to the metadata when the raster object is stored. Valid values: true, false. Default value: false.

Example:

SET ganos.raster.calculate_md5 = true;

Examples

The following example sets the MD5 hash string for the raster object with id = 1, then retrieves it using ST_MD5SUM to confirm the value.

SELECT ST_MD5SUM(ST_SetMD5Sum(rast, '21f41fd983d3139c75b04bff2b7bf5c9'))
FROM raster_table
WHERE id = 1;

Expected output:

              st_md5sum
-----------------------------------
 21f41fd983d3139c75b04bff2b7bf5c9