pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: upsert example about postgres9.5
3+ messages / 2 participants
[nested] [flat]

* Re: upsert example about postgres9.5
@ 2016-04-12 21:16  koff10 <koff10@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: koff10 @ 2016-04-12 21:16 UTC (permalink / raw)
  To: pgsql-admin


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 ?

Thanks
koff


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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: upsert example about postgres9.5
@ 2016-04-12 21:23  Gilberto Castillo <gilberto.castillo@etecsa.cu>
  parent: koff10 <koff10@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Gilberto Castillo @ 2016-04-12 21:23 UTC (permalink / raw)
  To: koff10 <koff10@hotmail.com>; +Cc: pgsql-admin


>
> 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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: upsert example about postgres9.5
@ 2016-04-12 21:39  koff10 <koff10@hotmail.com>
  parent: Gilberto Castillo <gilberto.castillo@etecsa.cu>
  0 siblings, 0 replies; 3+ messages in thread

From: koff10 @ 2016-04-12 21:39 UTC (permalink / raw)
  To: gilberto.castillo@etecsa.cu; +Cc: pgsql-admin

Thanks for your reply.
So there is no Sql instruction like UPSERT !

koff.

Le 12/04/2016 23:23, Gilberto Castillo a écrit :
>> 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
>



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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2016-04-12 21:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 21:16 Re: upsert example about postgres9.5 koff10 <koff10@hotmail.com>
2016-04-12 21:23 ` Gilberto Castillo <gilberto.castillo@etecsa.cu>
2016-04-12 21:39   ` koff10 <koff10@hotmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox