| From: | Lazaro Ruben Garcia Martinez <lgarciam(at)vnz(dot)uci(dot)cu> |
|---|---|
| To: | "pgsql-es-ayuda(at)postgresql(dot)org" <pgsql-es-ayuda(at)postgresql(dot)org> |
| Subject: | Sobre comando MERGE |
| Date: | 2013-11-29 15:36:23 |
| Message-ID: | 294D3D02D5E18D42827B2ECFEADEB688BA081E57B4@mx-interno.vnz.uci.cu |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
Buenos días a todos en la lista.
Existe algún soporte en PostgreSQL para hacer uso de la funcionalidad MERGE/UPSERT?
En caso de no existir una implementación utilizando CTE, podría ser factible como la siguiente:
WITH CTE AS (
UPDATE prueba
SET
nombre = 'Lazaro'
WHERE id = 1 RETURNING id
)
INSERT INTO public.prueba
(
id,
nombre
)
SELECT 1, 'Pepe' WHERE 1 NOT IN (SELECT CTE.id from CTE);
Un saludo a todos.
Fin a la injusticia, LIBERTAD AHORA A NUESTROS CINCO COMPATRIOTAS QUE SE ENCUENTRAN INJUSTAMENTE EN PRISIONES DE LOS EEUU!
http://www.antiterroristas.cu
http://justiciaparaloscinco.wordpress.com
-
Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda(at)postgresql(dot)org)
Para cambiar tu suscripción:
http://www.postgresql.org/mailpref/pgsql-es-ayuda
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2013-11-29 16:13:35 | Re: Sobre comando MERGE |
| Previous Message | Alvaro Herrera | 2013-11-29 00:02:09 | Re: kernel: Soft lockup |