
I'm not sure if this should be considered a bug or not. At least in my case it
doesn't cause a problem. I think it could always be worked around with
explicit casts in any case, it just seems... wrong:

db=> create or replace function array_length(integer[]) returns integer
    as 'SELECT array_upper($1)-array_lower($1)+1'
    language sql
    strict immutable;

ERROR:  function array_upper(integer[]) does not exist
HINT:  No function matches the given name and argument types. You may need to add explicit typecasts.

db=> create or replace function array_length(anyarray) returns integer
     as 'SELECT array_upper($1)-array_lower($1)+1'
     language sql
     strict immutable;

CREATE FUNCTION


-- 
greg


10 Sep 2003 14:46:05 -0400
Greg Stark <gsstark@mit.edu>
quirk of array type processing

On second thought, it does cause a problem:

db=> create table aa (aa integer[]);
CREATE TABLE

db=> select distinct(array_length(aa)) from aa;
ERROR:  function array_upper(integer[]) does not exist
HINT:  No function matches the given name and argument types. You may need to add explicit typecasts.
CONTEXT:  SQL function "array_length" during inlining

-- 
greg


10 Sep 2003 14:48:55 -0400
Greg Stark <gsstark@mit.edu>
Re: quirk of array type processing

On third though ignore this whole thread. I can't read.
sigh.

-- 
greg


10 Sep 2003 15:07:21 -0400
Greg Stark <gsstark@mit.edu>
Re: quirk of array type processing