All Products
Search
Document Center

PolarDB:ST_SetMetaData

Last Updated:Mar 28, 2026

Sets a metadata item on a raster object or a specific band. Setting the value to an empty string ('') deletes the metadata item.

Syntax

raster ST_SetMetaData(raster raster_obj,
                      text key,
                      text value);
raster ST_MetaData(raster raster_obj,
                   integer band,
                   text key,
                   text value);

Parameters

ParameterDescription
raster_objThe raster object whose metadata item you want to set.
bandThe sequence number of the band whose metadata item you want to set. Valid values start from 0.
keyThe name of the metadata item.
valueThe value of the metadata item. To delete the metadata item, set this parameter to an empty string ('').

Examples

Set and retrieve the NETCDF_DIM_time metadata item at the raster level:

SELECT ST_MetaData(ST_SetMetaData(rast, 'NETCDF_DIM_time', '12345'), 'NETCDF_DIM_time')
FROM raster_table

st_metadata
------------
12345

Set and retrieve the NETCDF_DIM_time metadata item at the band level:

SELECT ST_MetaData(ST_SetMetaData(rast, 0, 'NETCDF_DIM_time', '12345'), 0, 'NETCDF_DIM_time')
FROM raster_table

st_metadata
------------
12345