Re: Edit multiple rows concurrent save - Mailing list pgsql-sql

From Jasen Betts
Subject Re: Edit multiple rows concurrent save
Date
Msg-id j6p4ie$r1j$1@reversiblemaps.ath.cx
Whole thread Raw
In response to Edit multiple rows concurrent save  (Péter Szabó <matyee.nmi@gmail.com>)
List pgsql-sql
On 2011-09-29, Péter Szabó <matyee.nmi@gmail.com> wrote:

> users_has_cards.auctions + users_has_cards.decks never can be higher
> then users_has_cards.total. It should be also granted that
> users_has_cards.total - users_has_cards.auctions number of cards from
> a specific type can be in any decks.
>
> The deck assembly input comes from web, and parsed with PHP, so it is
> absolutely not trusted.
>
> I am started to write a PL/PgSQL function to handle the save of a
> deck, but it seems unable to solve this issue. I don't know how to go
> forward, so any idea is appreciated.

so users_has_cards has a check ( total >= decks + auctions )

and decks_has_cards  needs triggers on insert, update, and delete that 
manipulate the decks column of the users_has_cards record that
corresponds to that card.

This is probably goiung to make updates to the decks_has_cards table about 
10 times slower (should still be faster than you could have done in PHP)

-- 
⚂⚃ 100% natural



pgsql-sql by date:

Previous
From: Asli Akarsakarya
Date:
Subject: Re: a spatial table's bounding box
Next
From: Steve Northamer
Date:
Subject: plpgsql function executed multiple times for each return value