Re: upsert example about postgres9.5

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

 



>
> Hi all,
>
> It's known that postgres 9.5 has introduce  upsert  instruction.
> Is somebody can show  me how to use this instruction ?
> Do the UPSERT commande exists in  SQL ?
>


insert into accesos_usuarios (usuarios, accesos)
values ('8kdata',1)
on conflict (usuarios)
do update set
accesos = accesos_usuarios.accesos + EXCLUDED.accesos;

insert into accesos_usuarios (usuarios, accesos)
values ('8kdata',1), ('8kdata2',1)
on conflict do nothing;

Tomado de un presentación de Alvaro Hernadez  En Cuba

-- 
Saludos,
Gilberto Castillo
ETECSA, La Habana, Cuba



-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux