Skip site navigation (1) Skip section navigation (2)

Re: Transaction en erreur sur CLOSE ou INSERT

From: Stephane Bortzmeyer <bortzmeyer(at)nic(dot)fr>
To: philippe(dot)beaudoin(at)bull(dot)net
Cc: pgsql-fr-generale(at)postgresql(dot)org
Subject: Re: Transaction en erreur sur CLOSE ou INSERT
Date: 2009-01-12 10:26:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-fr-generale
On Sat, Jan 10, 2009 at 10:41:57AM +0100,
 philippe(dot)beaudoin(at)bull(dot)net <philippe(dot)beaudoin(at)bull(dot)net> wrote 
 a message of 68 lines which said:

> 2) Détection de doublon sur INSERT

N'est-ce pas ce qu'on appelle couramment un UPSERT
<> ? Si oui, outre la solution du
UPDATE-if-rowcount-0-INSERT, il y a celle du

Dans le deuxième cas, il faut évidemment tout emballer dans une
transaction au niveau SERIALIZABLE.

En attendant que quelqu'un code <> :

Add SQL-standard MERGE/REPLACE/UPSERT command

    MERGE is typically used to merge two tables. REPLACE or UPSERT command does UPDATE, or on failure, INSERT. This is similar to UPDATE, then for unmatched rows, INSERT. Whether concurrent access allows modifications which could cause row loss is implementation independent. To implement this cleanly requires that the table have a unique index so duplicate checking can be easily performed. It is possible to do it without a unique index if we require the user to LOCK the table before the MERGE.

        * someone working to add merge?
        * MERGE vs REPLACE
        * MERGE SQL Statement
        * MERGE Specification
        * Internal design of MERGE, with Rules 

In response to


pgsql-fr-generale by date

Next:From: Marc CousinDate: 2009-01-12 10:40:16
Subject: Re: Transaction en erreur sur CLOSE ou INSERT
Previous:From: Marc CousinDate: 2009-01-12 09:07:21
Subject: Re: Réf. : Re: [pgsql-fr-generale] Transaction en erreur sur CLOSE ou INSERT

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group