X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8FDE55367C for ; Wed, 20 Apr 2005 11:04:09 -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 88622-03 for ; Wed, 20 Apr 2005 14:04:03 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9FFC753669 for ; Wed, 20 Apr 2005 11:04:02 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 20EB330953; Wed, 20 Apr 2005 16:03:00 +0200 (MET DST) From: Chris Browne X-Newsgroups: pgsql.sql Subject: Re: Debet-Credit-Balance Calculation Date: Wed, 20 Apr 2005 09:43:05 -0400 Organization: cbbrowne Computing Inc Lines: 26 Message-ID: <60ll7d36om.fsf@dba2.int.libertyrms.com> References: <001c01c544ff$bb94d650$1f00a8c0@middinks> <003f01c545a7$b7e3c5e0$1f00a8c0@middinks> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:1cyeKkNTVnBUNXeeJaaa9gZ99iU= To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.17 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/302 X-Sequence-Number: 21195 middink@indo.net.id ("Muhyiddin A.M Hayat") writes: >> There is an easy way to do this; write a plpgsql set returning >> function which adds the balance to the last column of the table. That >> query will always have a cost in both time and memory proportional to >> the size of the table, and the memory cost may bite you as table size >> grows... >> -- > > Can you give me some example function which adds the balance to the > last column of the table. > > Thanks. No time, but here is a link to a useful article on SRFs. Once you know how to do an SRF, you should be able to build the one you need. -- (format nil "~S@~S" "cbbrowne" "acm.org") http://www.ntlug.org/~cbbrowne/sap.html Rules of the Evil Overlord #78. "I will not tell my Legions of Terror "And he must be taken alive!" The command will be: ``And try to take him alive if it is reasonably practical.''"