Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UF3Re-0007x5-VD for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Mar 2013 14:11:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UF3Re-0002hu-As for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Mar 2013 14:11:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UEqGb-0002GW-Tf for pgsql-bugs@postgresql.org; Mon, 11 Mar 2013 00:07:02 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UEqGa-00033E-HI for pgsql-bugs@postgresql.org; Mon, 11 Mar 2013 00:07:01 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UEqGZ-0001xz-14 for pgsql-bugs@postgresql.org; Mon, 11 Mar 2013 00:07:00 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1UEqGY-0000Qp-Po for pgsql-bugs@postgresql.org; Mon, 11 Mar 2013 00:06:58 +0000 Date: Mon, 11 Mar 2013 00:06:58 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7926: column 2 has type numeric(20, 2) in non-recursive term but type numeric overall To: pgsql-bugs@postgresql.org From: jakubkania@onet.pl X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 7926 Logged by: Jakub Kania Email address: jakubkania@onet.pl PostgreSQL version: 9.1.4 Operating system: Windows 7 Description:=20=20=20=20=20=20=20=20 I'm not really sure what is going on but I was advised on the IRC chanell to report it. I get the error: ERROR: recursive query "bank" column 2 has type numeric(20,2) in non-recursive term but type numeric overall LINE 6: SELECT ARRAY[id],amount::numeric(20,2) FROM bank_transacti... ^ HINT: Cast the output of the non-recursive term to the correct type. ********** Error ********** ERROR: recursive query "bank" column 2 has type numeric(20,2) in non-recursive term but type numeric overall SQL state: 42804 Hint: Cast the output of the non-recursive term to the correct type. Character: 140 WITH RECURSIVE bank(id,amount) AS ( SELECT ARRAY[id],amount::numeric(20,2) FROM bank_transactions UNION ALL SELECT b1.id||ARRAY[borg.id],b1.amount+borg.amount FROM bank AS b1 LEFT JOIN=20 bank_transactions AS borg ON borg.id>ALL(b1.id) ) SELECT * from bank LIMIT 100; With schema: CREATE TABLE bank_transactions ( id serial NOT NULL, amount numeric(20,2), CONSTRAINT bank_transactions_pkey PRIMARY KEY (id ) ) Casting the column the error is pointing too doesn't help at all, casting the one in the other select fixes it. http://sqlfiddle.com/#!12/0d00c/1 http://pastebin.com/1zWYxSZZ --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs