Opened 13 years ago

Closed 13 years ago

#1043 closed defect (wontfix)

[raster] ST_ValueCount proto returns integer instead of bigint

Reported by: robe Owned by: dustymugs
Priority: low Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: Cc:

Description (last modified by robe)

st_valuecount(rast raster, nband integer, exclude_nodata_value boolean, searchvalue double precision, roundto double precision DEFAULT 0)

others returns big int

also all the record based protos seem to return integer instead of bigint

Change History (7)

comment:1 by robe, 13 years ago

Description: modified (diff)

comment:2 by dustymugs, 13 years ago

The base ST_ValueCount returns an integer (or a set of) while the coverage ST_ValueCount returns bigint. The coverage version returns bigint because it uses a sum aggregate where PostgreSQL likes to use a bigint for a set of integers. If I had made the base ST_ValueCount return a bigint instead of an integer, the coverage ST_ValueCount would have returned numeric.

comment:3 by robe, 13 years ago

okay so I guess just fix that one then.

comment:4 by dustymugs, 13 years ago

I just took a look at all the ST_ValueCount functions and they are all correctly defined. I also took a look at the draft docs and it looks like the base ST_ValueCount functions with the "searchvalue" parameter are incorrectly listed as returning bigint. They all return integer.

bigint ST_ValueCount(raster rast, double precision searchvalue, double precision roundto=0);

bigint ST_ValueCount(raster rast, integer nband, boolean exclude_nodata_value, double precision searchvalue, double precision roundto=0);

bigint ST_ValueCount(raster rast, integer nband, double precision searchvalue, double precision roundto=0);

All three of the protos above return integer instead of bigint. The following example query is of the second proto above and returns an integer.

SELECT * FROM ST_ValueCount(
	ST_SetValue(
		ST_SetValue(
			ST_SetValue(
				ST_AddBand(
					ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,-1)
					, 1, '64BF', 0, 0
				)
				, 1, 1, 1, -10
			)
			, 1, 5, 4, 0
		)
		, 1, 5, 5, 3.14159
	)
, 1, TRUE, -10, 0);

comment:5 by pracine, 13 years ago

Summary: ST_ValueCount proto returns integer instead of bigint[raster] ST_ValueCount proto returns integer instead of bigint

comment:6 by pracine, 13 years ago

Owner: changed from pracine to dustymugs

comment:7 by dustymugs, 13 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.