text: SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, TRUE, ARRAY[]::double precision[], 0);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, NULL
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, TRUE, ARRAY[]::double precision[], 0);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, TRUE, NULL::double precision[], 0);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, FALSE, NULL::double precision[], 0);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, TRUE, NULL::double precision[], 0.1);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, ARRAY[3.1], 0.1);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, ARRAY[-10]);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , ARRAY[-10], 0);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , ARRAY[-10, 3]);
  SELECT ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, TRUE, 3.14, 0.19);
  SELECT ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, FALSE, 3.14, 0.01);
  SELECT ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, -10, 0.1);
  SELECT ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 1, -10);
  SELECT ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , -10., 10);
  SELECT ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 3.14159);
  SELECT ST_ValueCount(
  	ST_SetValue(
  		ST_SetValue(
  			ST_SetValue(
  				ST_AddBand(
  					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  					, 1, '64BF', 0, 0
  				)
  				, 1, 1, 1, -10
  			)
  			, 1, 5, 4, 0
  		)
  		, 1, 5, 5, 3.14159
  	)
  , 2);
  BEGIN;
  CREATE TEMP TABLE test
  	ON COMMIT DROP AS
  	SELECT
  		rast.rast
  	FROM (
  		SELECT ST_SetValue(
  			ST_SetValue(
  				ST_SetValue(
  					ST_AddBand(
  						ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
  						, 1, '64BF', 0, 0
  					)
  					, 1, 1, 1, -10
  				)
  				, 1, 5, 4, 0
  			)
  			, 1, 5, 5, 3.14159
  		) AS rast
  	) AS rast
  	FULL JOIN (
  		SELECT generate_series(1, 10) AS id
  	) AS id
  		ON 1 = 1;
  SELECT round(value::numeric, 3), count FROM ST_ValueCount('test', 'rast', 1, FALSE, NULL::double precision[], 0);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount('test', 'rast', 1, ARRAY[-10]::double precision[], 0);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount('test', 'rast', 1, ARRAY[1]::double precision[]);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount('test', 'rast', NULL::double precision[], 0.1);
  SELECT round(value::numeric, 3), count FROM ST_ValueCount('test', 'rast', ARRAY[-1, 3.1]::double precision[], 0.1);
  
  SELECT ST_ValueCount('test', 'rast', 1, TRUE, NULL::double precision, 0);
  SELECT ST_ValueCount('test', 'rast', 1, 3.14, 1);
  SELECT ST_ValueCount('test', 'rast', 1, -1);
  SELECT ST_ValueCount('test', 'rast', 3.1, 0.1);
  SELECT ST_ValueCount('test', 'rast', -9.);
  
  SAVEPOINT test;
  SELECT ST_ValueCount('test', 'rast', 2);
  ROLLBACK TO SAVEPOINT test;
  RELEASE SAVEPOINT test;
  SAVEPOINT test;
  SELECT ST_ValueCount('test1', 'rast', 2);
  ROLLBACK TO SAVEPOINT test;
  RELEASE SAVEPOINT test;
  SAVEPOINT test;
  SELECT ST_ValueCount('test', 'rast1', 2);
  ROLLBACK TO SAVEPOINT test;
  RELEASE SAVEPOINT test;
  
  ROLLBACK;
  