| From: | Tim Landscheidt <tim(at)tim-landscheidt(dot)de> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Query to "balance" rows across multiple tables | 
| Date: | 2010-07-02 11:56:02 | 
| Message-ID: | m3pqz65c8d.fsf@passepartout.tim-landscheidt.de | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Mike Christensen <mike(at)kitchenpc(dot)com> wrote:
> [...]
> Here's the catch: I want to DELETE any row (in either table) that has
> zero quantity, since I no longer need this data (plus I have a CHECK
> constraint on this value and require it to be positive anyway)..
> Is there actually a way to do this in a SQL function? Thanks!
Probably. But I wouldn't take that path: If your function
has a bug, you'll have /no/ record of what went wrong, but
only some numbers that may or may not be correct.
  So I'd rather use a more elaborate table structure where
you can track when you bought/planned to use/used what quan-
tity of items, and then use SUM() & Co. to report what you
own and what you need to buy.
Tim
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2010-07-02 12:03:05 | Re: pgpool-II (max_pool and num_init_children) | 
| Previous Message | Geoffrey | 2010-07-02 11:36:59 | pgpool-II (max_pool and num_init_children) |