]> granicus.if.org Git - postgis/commitdiff
Removed quantile data type. Ticket is #1939
authorBborie Park <bkpark at ucdavis.edu>
Sun, 29 Jul 2012 02:34:16 +0000 (02:34 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Sun, 29 Jul 2012 02:34:16 +0000 (02:34 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10134 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_raster.xml
raster/rt_pg/rtpostgis.sql.in.c
raster/rt_pg/rtpostgis_drop.sql.in.c

index d388c843375af98e3cfdcf32780e474cb6a50233..db9f6bd3a1505bcdabb6b9cc4dd68d3065c6e055 100644 (file)
@@ -5348,19 +5348,19 @@ FROM (SELECT rid, ST_Histogram(rast, 2,6,ARRAY[0.5,1,4,100,5]) As stats
                        <refsynopsisdiv>
                                <funcsynopsis>
                                  <funcprototype>
-                                       <funcdef>SETOF quantile <function>ST_Quantile</function></funcdef>
+                                       <funcdef>SETOF record <function>ST_Quantile</function></funcdef>
                                        <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
                                        <paramdef choice='opt'><type>integer </type> <parameter>nband=1</parameter></paramdef>
                                        <paramdef choice='opt'><type>boolean </type> <parameter>exclude_nodata_value=true</parameter></paramdef>
                                        <paramdef choice='opt'><type>double precision[] </type> <parameter>quantiles=NULL</parameter></paramdef>
                                  </funcprototype>
                                  <funcprototype>
-                                       <funcdef>SETOF quantile <function>ST_Quantile</function></funcdef>
+                                       <funcdef>SETOF record <function>ST_Quantile</function></funcdef>
                                        <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
                                        <paramdef><type>double precision[] </type> <parameter>quantiles</parameter></paramdef>
                                  </funcprototype>
                                  <funcprototype>
-                                       <funcdef>SETOF quantile <function>ST_Quantile</function></funcdef>
+                                       <funcdef>SETOF record <function>ST_Quantile</function></funcdef>
                                        <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
                                        <paramdef><type>integer </type> <parameter>nband</parameter></paramdef>
                                        <paramdef><type>double precision[] </type> <parameter>quantiles</parameter></paramdef>
@@ -5398,7 +5398,7 @@ FROM (SELECT rid, ST_Histogram(rast, 2,6,ARRAY[0.5,1,4,100,5]) As stats
                                  <!-- TABLE COVERAGE VERSIONS -->
                                  <!-- TODO: Add the rest and examples -->
                                  <funcprototype>
-                                       <funcdef>setof quantile <function>ST_Quantile</function></funcdef>
+                                       <funcdef>SETOF record <function>ST_Quantile</function></funcdef>
                                        <paramdef><type>text </type> <parameter>rastertable</parameter></paramdef>
                                        <paramdef><type>text </type> <parameter>rastercolumn</parameter></paramdef>
                                        <paramdef choice='opt'><type>integer </type> <parameter>nband=1</parameter></paramdef>
@@ -5406,7 +5406,7 @@ FROM (SELECT rid, ST_Histogram(rast, 2,6,ARRAY[0.5,1,4,100,5]) As stats
                                        <paramdef choice='opt'><type>double precision[] </type> <parameter>quantiles=NULL</parameter></paramdef>
                                  </funcprototype>
                                  <funcprototype>
-                                       <funcdef>setof quantile <function>ST_Quantile</function></funcdef>
+                                       <funcdef>SETOF record <function>ST_Quantile</function></funcdef>
                                        <paramdef><type>text </type> <parameter>rastertable</parameter></paramdef>
                                        <paramdef><type>text </type> <parameter>rastercolumn</parameter></paramdef>
                                        <paramdef><type>integer </type> <parameter>nband</parameter></paramdef>
index 36449bd63bfefaf7d7757c8aec886574b7393e36..2c43a95d39abe26630ab3cf9824aea0a1524ce0c 100644 (file)
@@ -815,30 +815,51 @@ CREATE OR REPLACE FUNCTION st_approxhistogram(rastertable text, rastercolumn tex
 -----------------------------------------------------------------------
 -- ST_Quantile and ST_ApproxQuantile
 -----------------------------------------------------------------------
-CREATE TYPE quantile AS (
-       quantile double precision,
-       value double precision
-);
-
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION _st_quantile(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION _st_quantile(
+       rast raster,
+       nband int DEFAULT 1,
+       exclude_nodata_value boolean DEFAULT TRUE,
+       sample_percent double precision DEFAULT 1,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS 'MODULE_PATHNAME','RASTER_quantile'
        LANGUAGE 'c' IMMUTABLE;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_quantile(
+       rast raster,
+       nband int DEFAULT 1,
+       exclude_nodata_value boolean DEFAULT TRUE,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, $3, 1, $4) $$
        LANGUAGE 'sql' IMMUTABLE;
 
-CREATE OR REPLACE FUNCTION st_quantile(rast raster, nband int, quantiles double precision[])
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_quantile(
+       rast raster,
+       nband int,
+       quantiles double precision[],
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, TRUE, 1, $3) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
-CREATE OR REPLACE FUNCTION st_quantile(rast raster, quantiles double precision[])
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_quantile(
+       rast raster,
+       quantiles double precision[],
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, 1, TRUE, 1, $2) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
@@ -864,25 +885,51 @@ CREATE OR REPLACE FUNCTION st_quantile(rast raster, quantile double precision)
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rast raster,
+       nband int DEFAULT 1,
+       exclude_nodata_value boolean DEFAULT TRUE,
+       sample_percent double precision DEFAULT 0.1,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, $3, $4, $5) $$
        LANGUAGE 'sql' IMMUTABLE;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, nband int, sample_percent double precision, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rast raster,
+       nband int,
+       sample_percent double precision,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, TRUE, $3, $4) $$
        LANGUAGE 'sql' IMMUTABLE;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, sample_percent double precision, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rast raster,
+       sample_percent double precision,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, 1, TRUE, $2, $3) $$
        LANGUAGE 'sql' IMMUTABLE;
 
-CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, quantiles double precision[])
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rast raster,
+       quantiles double precision[],
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, 1, TRUE, 0.1, $2) $$
        LANGUAGE 'sql' IMMUTABLE STRICT;
 
@@ -913,24 +960,54 @@ CREATE OR REPLACE FUNCTION st_approxquantile(rast raster, quantile double precis
        LANGUAGE 'sql' IMMUTABLE;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION _st_quantile(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION _st_quantile(
+       rastertable text,
+       rastercolumn text,
+       nband int DEFAULT 1,
+       exclude_nodata_value boolean DEFAULT TRUE,
+       sample_percent double precision DEFAULT 1,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS 'MODULE_PATHNAME','RASTER_quantileCoverage'
        LANGUAGE 'c' STABLE;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_quantile(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_quantile(
+       rastertable text,
+       rastercolumn text,
+       nband int DEFAULT 1,
+       exclude_nodata_value boolean DEFAULT TRUE,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, $3, $4, 1, $5) $$
        LANGUAGE 'sql' STABLE;
 
-CREATE OR REPLACE FUNCTION st_quantile(rastertable text, rastercolumn text, nband int, quantiles double precision[])
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_quantile(
+       rastertable text,
+       rastercolumn text,
+       nband int,
+       quantiles double precision[],
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, $3, TRUE, 1, $4) $$
        LANGUAGE 'sql' STABLE STRICT;
 
-CREATE OR REPLACE FUNCTION st_quantile(rastertable text, rastercolumn text, quantiles double precision[])
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_quantile(
+       rastertable text,
+       rastercolumn text,
+       quantiles double precision[],
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, 1, TRUE, 1, $3) $$
        LANGUAGE 'sql' STABLE STRICT;
 
@@ -956,25 +1033,55 @@ CREATE OR REPLACE FUNCTION st_quantile(rastertable text, rastercolumn text, quan
        LANGUAGE 'sql' STABLE STRICT;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_approxquantile(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rastertable text,
+       rastercolumn text,
+       nband int DEFAULT 1,
+       exclude_nodata_value boolean DEFAULT TRUE,
+       sample_percent double precision DEFAULT 0.1,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, $3, $4, $5, $6) $$
        LANGUAGE 'sql' STABLE;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_approxquantile(rastertable text, rastercolumn text, nband int, sample_percent double precision, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rastertable text,
+       rastercolumn text,
+       nband int,
+       sample_percent double precision,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, $3, TRUE, $4, $5) $$
        LANGUAGE 'sql' STABLE;
 
 -- Cannot be strict as "quantiles" can be NULL
-CREATE OR REPLACE FUNCTION st_approxquantile(rastertable text, rastercolumn text, sample_percent double precision, quantiles double precision[] DEFAULT NULL)
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rastertable text,
+       rastercolumn text,
+       sample_percent double precision,
+       quantiles double precision[] DEFAULT NULL,
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, 1, TRUE, $3, $4) $$
        LANGUAGE 'sql' STABLE;
 
-CREATE OR REPLACE FUNCTION st_approxquantile(rastertable text, rastercolumn text, quantiles double precision[])
-       RETURNS SETOF quantile
+CREATE OR REPLACE FUNCTION st_approxquantile(
+       rastertable text,
+       rastercolumn text,
+       quantiles double precision[],
+       OUT quantile double precision,
+       OUT value double precision
+)
+       RETURNS SETOF record
        AS $$ SELECT _st_quantile($1, $2, 1, TRUE, 0.1, $3) $$
        LANGUAGE 'sql' STABLE STRICT;
 
index 25ee00108e35260fe5280df72b08c540433e52e9..ea3eab4f8ccacd1d57716d8e07b342f58221e88b 100644 (file)
@@ -213,6 +213,7 @@ DROP FUNCTION IF EXISTS ST_PixelAsPolygons(raster,integer);
 DROP TYPE IF EXISTS bandmetadata;
 DROP TYPE IF EXISTS geomvalxy;
 DROP TYPE IF EXISTS summarystats;
+DROP TYPE IF EXISTS quantile;
 
 -- raster_columns and raster_overviews tables are deprecated
 DROP FUNCTION IF EXISTS _rename_raster_tables();