From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: Edit multiple rows concurrent save
Date: 8 Oct 2011 09:19:10 GMT
Message-ID: <j6p4ie$r1j$1@reversiblemaps.ath.cx> (raw)
References: <CANhnSQfP91Wy5DUSSYxqd9ngAKBuYuGZrWjNpYjj=QCjy=3K2g@mail.gmail.com>
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
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasen@xnet.co.nz
Subject: Re: Edit multiple rows concurrent save
In-Reply-To: <j6p4ie$r1j$1@reversiblemaps.ath.cx>
* 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