Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hiRbV-00052t-AY for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Jul 2019 22:50:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hiRbU-0003MF-6t for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Jul 2019 22:50:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hiRbT-0003M6-SM for pgsql-bugs@lists.postgresql.org; Tue, 02 Jul 2019 22:50:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hiRbR-0005I7-MG for pgsql-bugs@lists.postgresql.org; Tue, 02 Jul 2019 22:50:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x62MoKjW017560; Tue, 2 Jul 2019 18:50:20 -0400 From: Tom Lane To: Manuel Rigger cc: PostgreSQL mailing lists Subject: Re: SELECT results in "ERROR: index key does not match expected index column" In-reply-to: References: Comments: In-reply-to Manuel Rigger message dated "Wed, 03 Jul 2019 00:00:37 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17558.1562107819.1@sss.pgh.pa.us> Date: Tue, 02 Jul 2019 18:50:20 -0400 Message-ID: <17559.1562107820@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Manuel Rigger writes: > Consider the following test case: > CREATE TABLE t0(c0 boolean UNIQUE); > CREATE INDEX i0 ON t0((nullif(FALSE, TRUE))); > INSERT INTO t0(c0) VALUES(TRUE); > SELECT * FROM t0 WHERE nullif(FALSE, TRUE) OR t0.c0; > ERROR: index key does not match expected index column Huh. I don't see that in HEAD/v12, but it does reproduce in v11 and quite a large number of branches before that. Looking ... (You realize of course that an index on a constant is pretty useless. I wonder if we should disallow that.) regards, tom lane