]> granicus.if.org Git - postgis/commitdiff
Reverting changes that optimize ST_MapAlgebraExpr. Re-advertise x and y parameters...
authorDavid Zwarg <dzwarg@azavea.com>
Tue, 14 Feb 2012 17:00:00 +0000 (17:00 +0000)
committerDavid Zwarg <dzwarg@azavea.com>
Tue, 14 Feb 2012 17:00:00 +0000 (17:00 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9185 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_pg/rt_pg.c

index d1af077a61b2d53b4c73d93d6d73f1516b6d6418..7799c92fd46c9de0d2ab071bd853bd4409ee90a3 100644 (file)
@@ -2596,8 +2596,9 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS)
     const int argkwcount = 3;
     enum KEYWORDS { kVAL=0, kX=1, kY=2 };
     char *argkw[] = {"[rast]", "[rast.x]", "[rast.y]"};
+    Oid argkwtypes[] = { FLOAT8OID, INT4OID, INT4OID };
     int argcount = 0;
-    Oid argtype[] = { FLOAT8OID, FLOAT8OID, FLOAT8OID };
+    Oid argtype[] = { FLOAT8OID, INT4OID, INT4OID };
     uint8_t argpos[3] = {0};
     char place[5];
     int idx = 0;
@@ -3038,6 +3039,7 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS)
             newexpr = rtpg_strreplace(initexpr, argkw[i], place, &len);
             pfree(initexpr); initexpr=newexpr;
             if (len > 0) {
+                argtype[argcount] = argkwtypes[i];
                 argcount++;
                 argpos[i] = j++;
 
@@ -3129,12 +3131,12 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS)
 
                             if (i == kX ) {
                                 /* x is 0 based index, but SQL expects 1 based index */
-                                values[idx] = Float8GetDatum((float)(x+1));
+                                values[idx] = Int32GetDatum(x+1);
                                 nulls[idx] = ' ';
                             }
                             else if (i == kY) {
                                 /* y is 0 based index, but SQL expects 1 based index */
-                                values[idx] = Float8GetDatum((float)(y+1));
+                                values[idx] = Int32GetDatum(y+1);
                                 nulls[idx] = ' ';
                             }
                             else if (i == kVAL ) {