Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 86F149FB3F7 for ; Tue, 13 Mar 2007 10:41:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 35081-05 for ; Tue, 13 Mar 2007 10:40:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 7E8779FB5A5 for ; Tue, 13 Mar 2007 10:41:02 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-201-67.bk11-dsl.surnet.cl [201.221.201.67]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l2DDes6n021234; Tue, 13 Mar 2007 06:40:56 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 1E4AE32A15; Tue, 13 Mar 2007 09:40:41 -0400 (CLT) Date: Tue, 13 Mar 2007 09:40:41 -0400 From: Alvaro Herrera To: "Ezequias R. da Rocha" Cc: pgsql-sql@postgresql.org Subject: Re: For loop Message-ID: <20070313134041.GB6715@alvh.no-ip.org> Mail-Followup-To: "Ezequias R. da Rocha" , pgsql-sql@postgresql.org References: <45F6B4EB.A3DD.0030.0@indicator.be> <45F6A793.1090904@fastcon.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45F6A793.1090904@fastcon.com.br> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 13 Mar 2007 06:40:56 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/161 X-Sequence-Number: 27799 Ezequias R. da Rocha wrote: > I quetion one more time. I must have a function ? Isn't another way to > implement it without using functions ? The syntax you show is plpgsql. You cannot use that without a function. (The alternative would be to script the bulk insertion client-side, which I'd think is smarter anyway). If what you need to do is batch processing of rows to produce other rows, then maybe you can craft an INSERT .. SELECT query to do it instead of this row-at-a-time approach. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.