X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C38D0D1C9BA for ; Tue, 3 Feb 2004 16:21:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 95153-08 for ; Tue, 3 Feb 2004 12:21:55 -0400 (AST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by svr1.postgresql.org (Postfix) with ESMTP id 78631D1B917 for ; Tue, 3 Feb 2004 12:21:55 -0400 (AST) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Ao3JC-00052K-00 for ; Tue, 03 Feb 2004 17:21:54 +0100 Received: from srv.protecting.net ([212.126.218.242]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue Feb 3 16:21:54 2004 Received: from hf118 by srv.protecting.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue Feb 3 16:21:54 2004 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-admin@postgresql.org From: Harald Fuchs Subject: Re: Alternative to "Money" ... Date: 03 Feb 2004 17:21:52 +0100 Organization: Linux Private Site Lines: 31 Message-ID: References: <20040203160813.81708.qmail@web13808.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: srv.protecting.net X-No-Archive: yes User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/28 X-Sequence-Number: 12202 In article <20040203160813.81708.qmail@web13808.mail.yahoo.com>, Chris Gamache writes: > That does make more sense (cents? :) ). > View and rule still apply, tho. Better performance still? > create temporary table new_money (product text, cents int4); > create view v_new_money as select product, (cents::numeric/100)::numeric(10,2) > as dollars from new_money; > create rule v_new_money_upd as on update to v_new_money do instead update > new_money set product=new.product, cents=new.dollars * 100 where product = > old.product; > create rule v_new_money_del as on delete to v_new_money do instead delete from > new_money where product = old.product; > create rule v_new_money_ins as on insert to v_new_money do instead insert into > new_money (product, cents) values (new.product, new.dollars * 100); > insert into new_money (product, cents) values ('Flowbee','1995'); > insert into new_money (product, cents) values ('Country Hits','995'); > insert into v_new_money (product, dollars) values ('ThighMaster','39.95'); > update v_new_money set dollars = '14.95' where product='Flowbee';