When grilled further on (Mon, 09 Feb 2004 13:49:17 +),
Mark Gibson <[EMAIL PROTECTED]> confessed:
> I probably didn't make this clear enough:
>
Nah. After re-reading your e-mail, I say what I missed the first time. 'Bout 1
hour before my normal thinking time...
Cheers,
Rob
--
20:20:54
Tom Lane wrote:
Mark Gibson <[EMAIL PROTECTED]> writes:
CREATE RULE bag_rel AS ON INSERT TO bag_test
WHERE
EXISTS (SELECT 1 FROM bag_test WHERE item = NEW.item)
DO INSTEAD
UPDATE bag_test SET qty = qty + NEW.qty WHERE item = NEW.item;
This can't work because an ON INSERT r
Richard Sydney-Smith wrote:
Mark,
love the idea, guess I should have read it somewhere but haven't. Obvious
and beautiful. Please let me know if you or someone else solves the initial
double value.
I used to use functions for this kind of thing,
and was thinking that what SQL really needed was
Mark Gibson <[EMAIL PROTECTED]> writes:
> Alternatively, for the relative option (increase 'apple' by 12), replace
> the 'bag_abs' rule with:
> CREATE RULE bag_rel AS ON INSERT TO bag_test
> WHERE
> EXISTS (SELECT 1 FROM bag_test WHERE item = NEW.item)
> DO INSTEAD
> UPDATE
n" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 09, 2004 8:42 PM
Subject: [SQL] Implementation of a bag pattern using rules
> Hello,
> I've been playing around with a simple solution for a bag or sparse
> matrix using rules,
> but have
Robert Creager wrote:
When grilled further on (Mon, 09 Feb 2004 12:42:10 +),
Mark Gibson <[EMAIL PROTECTED]> confessed:
CREATE RULE bag_abs AS ON INSERT TO bag_test
WHERE
EXISTS (SELECT 1 FROM bag_test WHERE item = NEW.item)
DO INSTEAD
UPDATE bag_test SET qty = NEW.qty WHER
Hello,
I've been playing around with a simple solution for a bag or sparse
matrix using rules,
but have encountered a few problems I wish to discuss.
The bag pattern is commonly used for shopping baskets (item => quantity).
This sollution can also be used for a sparse matrix too (row,col => val