Re: SQL design pattern for a delta trigger?

Vick Khera <vivek@khera.org>

From: Vivek Khera <vivek@khera.org>
To: PGSQL Mailing List <pgsql-general@postgresql.org>
Date: 2007-12-10T19:09:15Z
Lists: pgsql-general
On Dec 7, 2007, at 11:42 AM, Colin Wetherbee wrote:

> You can do this with a conditional.  Something like the following  
> should work.
>
> IF
>  NOT (a query matching your data returns rows)
> THEN
>  INSERT (your new data)

There exists a race condition here unless you've locked your tables.