From: koff10 <koff10@hotmail.com>
To: gilberto.castillo@etecsa.cu
Cc: pgsql-admin@postgresql.org
Subject: Re: upsert example about postgres9.5
Date: Tue, 12 Apr 2016 23:39:46 +0200
Message-ID: <BLU437-SMTP8F617F3039AAF88CEF289CA950@phx.gbl> (raw)
In-Reply-To: <58935.192.168.207.54.1460496234.squirrel@webmail.etecsa.cu>
References: <CAE_gQfU4s2pJezO78GfcgdkUWi9FkdD+_DppMxMi6fRUnUcOeg@mail.gmail.com>
<CAGnEboi83_TcZqJzuGcs6vFASSZ1EoN8m2Q8yXWWj466nOOEiA@mail.gmail.com>
<BLU436-SMTP2450160A5A13245DCBAC474CA950@phx.gbl>
<58935.192.168.207.54.1460496234.squirrel@webmail.etecsa.cu>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: koff10@hotmail.com, gilberto.castillo@etecsa.cu
Subject: Re: upsert example about postgres9.5
In-Reply-To: <BLU437-SMTP8F617F3039AAF88CEF289CA950@phx.gbl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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