[postgis-users] extra function?

Stephen Crawford src176 at psu.edu
Wed Feb 22 13:56:00 PST 2012


_st_summarystats and st_summarystats are listed with the same exact 
arguments.  Should this be the case?  There are also 7 other 
"st_summarystats" listed, all with different numbers of arguments.

And now I'm really out the door, back at it tomorrow, many thanks.

On 2/22/2012 4:48 PM, Bborie Park wrote:
> Good point.  I didn't think about duplicative function declarations, 
> though that shouldn't happen as the function signatures haven't 
> changed in a long time.
>
> -bborie
>
> On 02/22/2012 01:39 PM, John Callahan wrote:
>> Steve,
>>
>> I had a similar issue.  If you look at your list of functions (say 
>> through
>> pgAdmin), you'll probably see multiple instances of that function.  
>> If the
>> same function is listed more than once, with the same number and type of
>> arguments, then it will (I think?) report as not unique.  In that 
>> case, I
>> manually deleted the duplicate functions, and then added them back.  
>> To add
>> them back, look inside the rt_postgis.sql (or postgis.sql) file than 
>> comes
>> with the distribution (I'm using alpha5).  you'll see all of the 
>> functions
>> in there.  Just cut and paste the necessary CREATE OR REPLACE statements
>> for your functions into the Query Tool or psql console window.
>>
>> - John
>>
>> ***********************************************
>> John Callahan, Research Scientist
>> Delaware Geological Survey, University of Delaware
>> URL: http://www.dgs.udel.edu
>> *************************************************
>>
>>
>>
>> On Wed, Feb 22, 2012 at 4:28 PM, Bborie Park<bkpark at ucdavis.edu>  wrote:
>>
>>> Steve,
>>>
>>> I know enough to do my own testing and make the necessary changes. 
>>> Until I
>>> have the time to do so, the following should work.
>>>
>>> CREATE OR REPLACE FUNCTION st_summarystats(rast raster,
>>> exclude_nodata_value boolean)
>>> RETURNS summarystats
>>> AS $$ SELECT _st_summarystats($1, 1, $2, 1.) $$
>>> LANGUAGE 'SQL' IMMUTABLE STRICT;
>>>
>>> -bborie
>>>
>>> On 02/22/2012 12:16 PM, Stephen Crawford wrote:
>>>
>>>> Tried running it and get this:
>>>>
>>>> "ERROR: function _st_summarystats(raster, integer, boolean, 
>>>> integer) is
>>>> not unique
>>>> LINE 3: AS $$ SELECT _st_summarystats($1, 1::int, $2, 1) $$
>>>> ^
>>>> HINT: Could not choose best candidate function. You might need to add
>>>> explicit type casts"
>>>>
>>>> -Steve
>>>>
>>>> On 2/22/2012 1:59 PM, Bborie Park wrote:
>>>>
>>>>> Interesting. Can you run the following and try again?
>>>>>
>>>>> CREATE OR REPLACE FUNCTION st_summarystats(rast raster,
>>>>> exclude_nodata_value boolean)
>>>>> RETURNS summarystats
>>>>> AS $$ SELECT _st_summarystats($1, 1::int, $2, 1) $$
>>>>> LANGUAGE 'SQL' IMMUTABLE STRICT;
>>>>>
>>>>> If that removes the HINT, I'll make the appropriate changes to the 
>>>>> code.
>>>>>
>>>>> -bborie
>>>>>
>>>>> On 02/22/2012 10:48 AM, Stephen Crawford wrote:
>>>>>
>>>>>> I only tried the casting because of the messages I get, on of 
>>>>>> which is:
>>>>>>
>>>>>> "function _st_summarystats($1, 1, $2, 1) is not unique"
>>>>>> and
>>>>>> "HINT: Could not choose best candidate function. You might need 
>>>>>> to add
>>>>>> explicit type casts"
>>>>>>
>>>>>> Thanks,
>>>>>> steve
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 2/22/2012 1:41 PM, Bborie Park wrote:
>>>>>>
>>>>>>> Hey Steve,
>>>>>>>
>>>>>>> _st_summarystats is an underlying function that isn't meant for 
>>>>>>> use by
>>>>>>> end-users. ST_SummaryStats is what you should be using.
>>>>>>>
>>>>>>> The example query you provided shouldn't have any issues and 
>>>>>>> shouldn't
>>>>>>> be creating any of those messages. In your situation, you don't 
>>>>>>> even
>>>>>>> need the true::boolean.
>>>>>>>
>>>>>>> -bborie
>>>>>>>
>>>>>>> On 02/22/2012 10:34 AM, Stephen Crawford wrote:
>>>>>>>
>>>>>>>> Should I have both _st_summarystats and st_summarystats in my
>>>>>>>> database?
>>>>>>>> I get messages like "function not unique" and "could not choose 
>>>>>>>> best
>>>>>>>> candidate function" when doing this:
>>>>>>>>
>>>>>>>> SELECT rid, observation_date, ST_SummaryStats(rast::raster,
>>>>>>>> true::boolean) FROM spring_ms WHERE observation_date = 
>>>>>>>> '2012-02-20';
>>>>>>>>
>>>>>>>> I expected to get 187 records (one for each tile).
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Steve
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>> -- 
>>> Bborie Park
>>> Programmer
>>> Center for Vectorborne Diseases
>>> UC Davis
>>> 530-752-8380
>>> bkpark at ucdavis.edu
>>> ______________________________**_________________
>>> postgis-users mailing list
>>> postgis-users at postgis.**refractions.net<postgis-users at postgis.refractions.net> 
>>>
>>> http://postgis.refractions.**net/mailman/listinfo/postgis-**users<http://postgis.refractions.net/mailman/listinfo/postgis-users> 
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

-- 
Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University
src176 at psu.edu
814.865.9905





More information about the postgis-users mailing list