Re: A question about inheritance and sequence

From: Marko Pahić <mpahic(at)gmail(dot)com>
To: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: A question about inheritance and sequence
Date: 2009-06-24 19:40:03
Message-ID: 4ae2a0950906241240y4627da43uc403e53ae2bf926d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Triggers are generally more robust. Quick example:
> NEW.noteid := SELECT 1+ COALESCE( (SELECT noteid FROM "Notes" WHERE
> userkey=NEW.userkey ORDER BY noteid DESC LIMIT 1), 0 );

Can you please write me the whole trigger? I've been reading the manual for
an hour and I have no idea in where to apply this code.

>
>
> Applications must take care of race conditions (like 2 clients trying to
> insert same noteid).

Doesn't the multiple primary key key fix this problem?

--
Human beings make life so interesting.
Do you know that in a universe so full of wonder,
they have managed to invent boredom? Quite astonishing.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Geoffrey 2009-06-24 19:59:30 Re: Replication
Previous Message Dave Page 2009-06-24 19:31:56 Re: 8.4 RC1 on ubuntu 9.04 jaunty, problems after install