From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | nmgjinan(at)126(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13675: Problem statement “INSERT ON CONFLICT WHERE" |
Date: | 2015-10-13 01:47:29 |
Message-ID: | 20151013014729.GC20675@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 2015-10-13 01:42:09 +0000, nmgjinan(at)126(dot)com wrote:
> postgres=# insert into distributors values (1,'hgdb')
> postgres-# on conflict (did) where is_active do update set
> dname=EXCLUDED.dname;
> INSERT 0 1
> postgres=# select * from distributors ;
> did | dname | is_active
> -----+-------+-----------
> 2 | bbb | t
> 1 | hgdb | f
> (2 rows)
>
> postgres=#
>
> Why, when the where condition is true or false, the fields are change?
The WHERE above is parsed as parsed as the ON CONFLICT clause - where
it's just for specifying partial indexes and such. Put the WHERE after
the DO UPDATE and you'll be good.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Noah Misch | 2015-10-13 02:08:31 | Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::') |
Previous Message | nmgjinan | 2015-10-13 01:42:09 | BUG #13675: Problem statement “INSERT ON CONFLICT WHERE" |