X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A6E51D1B1AE for ; Mon, 19 Jul 2004 01:23:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22673-08 for ; Mon, 19 Jul 2004 04:23:23 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A8A17D1B16E for ; Mon, 19 Jul 2004 01:23:22 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i6J4NM5Y008714; Mon, 19 Jul 2004 00:23:22 -0400 (EDT) To: mmarencibia@yahoo.es (Marcos Medina) Cc: pgsql-novice@postgresql.org Subject: Re: FOR-IN-EXECUTE, why fail? In-reply-to: References: Comments: In-reply-to mmarencibia@yahoo.es (Marcos Medina) message dated "14 Jul 2004 08:13:40 -0700" Date: Mon, 19 Jul 2004 00:23:21 -0400 Message-ID: <8713.1090211001@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200407/147 X-Sequence-Number: 10479 mmarencibia@yahoo.es (Marcos Medina) writes: > I wrote the following: > CREATE OR REPLACE FUNCTION escritorio.seq_valor_actual( text) > DECLARE > ... > actual integer; > BEGIN > ... > FOR actual IN EXECUTE v_query LOOP The loop variable has to be a record or row variable, not an integer. FWIW, 7.5 will give a better error message for this common mistake. In CVS tip I get ERROR: loop variable of loop over rows must be a record or row variable at or near "LOOP" at character 416 LINE 14: FOR actual IN EXECUTE v_query LOOP ^ regards, tom lane