Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cobIV-0000Lo-CD for pgsql-bugs@arkaria.postgresql.org; Thu, 16 Mar 2017 19:42:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cobIU-0002vZ-VT for pgsql-bugs@arkaria.postgresql.org; Thu, 16 Mar 2017 19:42:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cobHn-0001hF-Ty for pgsql-bugs@postgresql.org; Thu, 16 Mar 2017 19:42:12 +0000 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cobHk-0004om-Op for pgsql-bugs@postgresql.org; Thu, 16 Mar 2017 19:42:11 +0000 Received: by mail-lf0-x232.google.com with SMTP id y193so24824467lfd.3 for ; Thu, 16 Mar 2017 12:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=8JOU91OhQy8VHi1oAyONDp/AGah9UAsriktIuAPsIVM=; b=WNzXjIquUr7vI/ebq/El0+5UR1Hl7GHg+ZWeQbY4sKZEZQeQPPpyCH10XED2S+qzw5 L/rzFaeY7jxBakGeZnbqp/j7GpzFsBacpv/r+ucUdbWpfqKZLA/XHHkchnQ11qc5MYZB lfjVHXOXUQYEi+t8ouAeM6Ah3/YnuGcy36Anq+i4C0sjx0yHXBJrIBvucDAQQqgvraAk C+Of7riMzYwnnWsUCPJFb5qOwplFO2XdgWR4vSoEEmTfJfEQMfblr0gA6nyw4geAbDJB vqVfh9ODsTU/4ecgTCYngXdNihYPy4zSg+oKUFqHUHwBwVkNxWWQQ9vIdLetR6QtUE7D MO0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=8JOU91OhQy8VHi1oAyONDp/AGah9UAsriktIuAPsIVM=; b=bEehNwSFtcHruyVFkXdtt1Nw/jdYqwLbLFYsqyshKeXgf0vjUVFSj0MTLYL8bdTTEA +KLjQUbd8dzb5qQYP97/6NNm6UctoJ1Mr2JQnQovlUD8vmoOnvoo2NFZZhr5E6v405wg t1D18qfWzKQiMzpB3o4wA9r8Bvq9/JdopUmuk/bpab6N6fd0ruP7GIOuuBOefw/3an6/ 1UBMTUKceKNUbUt1Z2Z5MZdQ3xgsEXbd/kkAtYWZqcHb9BkZN5bEWkL5sbWoXn7hOs+5 woSvTshnrUg6FIMV6iL6o7ANC+L2xpl9uqt+EAvLZb876sfOTXOPacqjyj6CfgtKfrB+ 1Jag== X-Gm-Message-State: AFeK/H26eeQOqASTG4bto6FUBKY8YoDsV8SfAiignf35Y9Aj6LNeepU7WRQUW1cn0wnJyQ== X-Received: by 10.46.75.26 with SMTP id y26mr3704659lja.27.1489693326516; Thu, 16 Mar 2017 12:42:06 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibrasgw1-50df7f-241.dhcp.inet.fi. [80.223.127.241]) by smtp.gmail.com with ESMTPSA id g4sm1076926lji.35.2017.03.16.12.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Mar 2017 12:42:05 -0700 (PDT) Subject: Re: ON CONFLICT with constraint name doesn't work To: Nikolay Samokhvalov , PostgreSQL mailing lists References: From: Heikki Linnakangas Message-ID: <20920c13-784f-05b5-6f86-dac31dc1d970@iki.fi> Date: Thu, 16 Mar 2017 21:42:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 03/16/2017 09:34 PM, Nikolay Samokhvalov wrote: > I don't see anything in the current docs > https://www.postgresql.org/docs/9.6/static/sql-insert.html saying that I > cannot use the unique index' name here. So it definitely looks like a bug. This is by design. The docs on conflict_target says: "Specifies which conflicts ON CONFLICT takes the alternative action on by choosing arbiter indexes. Either performs unique index inference, or names a *constraint* explicitly." (emphasis mine) As it says, you can name a constraint explicitly. A unique index is not a constraint. We debated this for a long time when the ON CONFLICT feature was being developed. In the end, we settled on this behavior, on the grounds that a constraint is a logical concept, while an index is a physical implementation detail. Note that the SQL standard also doesn't say anything about indexes, but constraints are in the standard. - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs