Re: Edit multiple rows concurrent save

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Edit multiple rows concurrent save
Date: 2011-10-08 09:19:10
Message-ID: j6p4ie$r1j$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2011-09-29, Péter Szabó <matyee(dot)nmi(at)gmail(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David Johnston 2011-10-08 15:50:21 Re: plpgsql function executed multiple times for each return value
Previous Message Steve Northamer 2011-10-06 17:59:28 plpgsql function executed multiple times for each return value