Re: INSERT OU UPDATE WITHOUT SELECT?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PFC wrote:
> >PostgreSQL does not support MERGE at the moment, sorry.
> 
> 	Issue an UPDATE, and watch the rowcount ; if the rowcount is 0, 
> 	issue an  INSERT.
> 	Be prepared to retry if another transaction has inserted the row  
> meanwhile, though.

Oh, you mean, like the example that's in the documentation?

http://www.postgresql.org/docs/8.1/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

Example 36-1

> 	MERGE would be really useful.

It has been discussed before -- MERGE is something different.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux