pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Harald Fuchs <hf99@protecting.net>
To: pgsql-admin@postgresql.org
Subject: Re: Alternative to "Money" ...
Date: 03 Feb 2004 17:17:40 +0100
Message-ID: <puptcwxhln.fsf@srv.protecting.net> (raw)
References: <OAEAKHEHCMLBLIDGAFELAEECEJAA.matt@ymogen.net>
	<20040203160813.81708.qmail@web13808.mail.yahoo.com>

In article <20040203160813.81708.qmail@web13808.mail.yahoo.com>,
Chris Gamache <cgg007@yahoo.com> writes:

> 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';



view thread (10+ messages)  latest in thread

Message-ID: <puptcwxhln.fsf@srv.protecting.net>
Permalink:  ../puptcwxhln.fsf@srv.protecting.net/
Also on:    postgresql.org/message-id/puptcwxhln.fsf@srv.protecting.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: hf99@protecting.net
  Subject: Re: Alternative to "Money" ...
  In-Reply-To: <puptcwxhln.fsf@srv.protecting.net>
  References: <OAEAKHEHCMLBLIDGAFELAEECEJAA.matt@ymogen.net> <20040203160813.81708.qmail@web13808.mail.yahoo.com> <puptcwxhln.fsf@srv.protecting.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox