Received: from actarg.com (host25.actarg.com [209.180.91.25] (may be forged)) by postgresql.org (8.11.3/8.11.1) with ESMTP id f2TK2FK88147 for ; Thu, 29 Mar 2001 15:02:15 -0500 (EST) (envelope-from kyle@actarg.com) Received: from chi.actarg.com (IDENT:root@chi.actarg.com [192.168.2.16]) by actarg.com (8.9.3/8.9.3) with ESMTP id NAA17187 for ; Thu, 29 Mar 2001 13:02:13 -0700 Received: from actarg.com (IDENT:kyle@localhost [127.0.0.1]) by chi.actarg.com (8.9.3/8.9.3) with ESMTP id NAA25764 for ; Thu, 29 Mar 2001 13:02:14 -0700 Message-ID: <3AC394C6.E7D2E184@actarg.com> Date: Thu, 29 Mar 2001 13:02:14 -0700 From: Kyle Organization: Action Target Inc. X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Possible 7.1RC1 bug Content-Type: multipart/mixed; boundary="------------3C04861CA77FC0D51B8DE7CB" X-Archive-Number: 200103/618 X-Sequence-Number: 2289 This is a multi-part message in MIME format. --------------3C04861CA77FC0D51B8DE7CB Content-Type: multipart/alternative; boundary="------------08AEC5F55C95FC086C676A25" --------------08AEC5F55C95FC086C676A25 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Here's a fragment of code that works on 7.0.3 but gives a type mismatch on 7.1: Under 7.1RC1, func1 fails and func2 builds OK. The error is: ERROR: return type mismatch in function: declared to return int4, returns numeric It appears that sum(int4) returns type numeric. Shouldn't it return int4? create table ints ( inte int4 ); create function func1() returns int4 as ' select coalesce(sum(inte),0) from ints; ' language 'sql'; create function func2() returns int4 as ' select coalesce(sum(inte)::int4,0) from ints; ' language 'sql'; --------------08AEC5F55C95FC086C676A25 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Here's a fragment of code that works on 7.0.3 but gives a type mismatch on 7.1:

Under 7.1RC1, func1 fails and func2 builds OK.  The error is:

ERROR:  return type mismatch in function: declared to return int4, returns numeric

It appears that sum(int4) returns type numeric.  Shouldn't it return int4?
 

create table ints (
    inte        int4
);

create function func1() returns int4 as '
    select coalesce(sum(inte),0) from ints;
' language 'sql';

create function func2() returns int4 as '
    select coalesce(sum(inte)::int4,0) from ints;
' language 'sql';
 
  --------------08AEC5F55C95FC086C676A25-- --------------3C04861CA77FC0D51B8DE7CB Content-Type: text/x-vcard; charset=us-ascii; name="kyle.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Kyle Content-Disposition: attachment; filename="kyle.vcf" begin:vcard n:Bateman;Kyle x-mozilla-html:FALSE org:Action Target Inc. adr:;;;;;; version:2.1 email;internet:kyle@actarg.com title:President x-mozilla-cpt:;0 fn:Kyle Bateman end:vcard --------------3C04861CA77FC0D51B8DE7CB--