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 1hxsyi-0005Et-1w for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Aug 2019 13:06:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hxsyg-0000PJ-TU for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Aug 2019 13:06:10 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxsyg-0000JC-Iq for pgsql-bugs@lists.postgresql.org; Wed, 14 Aug 2019 13:06:10 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hxsyZ-0002Hx-7j for pgsql-bugs@lists.postgresql.org; Wed, 14 Aug 2019 13:06:09 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 4D52721C3F8C; Wed, 14 Aug 2019 16:06:01 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 25D6521C3F8A; Wed, 14 Aug 2019 16:06:01 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1565787961; bh=irHGPpaReuRrBxHSosi6/wHGyUp0uB5COsJJ/q4yxyI=; h=Subject:To:References:From:Date:In-Reply-To; b=O6dPwp6rng+GnEZ/ELGeRYC2625AeFP+E3+NlC4t/8qRecWajFK+R4tixcKtvgku/ XPDroW0Q0J6jXfEhVzLEt+Cyg8VyMq1fAHIJTbYKCcnmBKH/u1VzPVEneWnzCkcXiV PU6WlDsfRsVDdMzZRa4fWs3YJqVqXmaIIOwszLqU= Subject: Re: Postgres 10&11 data processing error To: =?UTF-8?B?0JDQu9C10LrRgdCw0L3QtNGAINCU0LXQvdC10LbQutC40L0=?= , pgsql-bugs@lists.postgresql.org References: From: Konstantin Knizhnik Message-ID: Date: Wed, 14 Aug 2019 16:05:57 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, On 14.08.2019 15:44, Александр Денежкин wrote: > Hello, i guess there is the error in Postgresql 10.x and 11.x. I'm > using russian ERP platform 1C with Postgres for data processing and > storing. > > Postgres 10 and 11 (both Linux and Windows) logs error: > 2019-08-14 09:05:10.758 MSK [31696] ERROR:  index key does not match > expected index column > > On query: > > 2019-08-14 07:40:03.417 MSK [12538] STATEMENT:  SELECT > T1._IDRRef, > T1._Fld745RRef, > T1._Date_Time, > T1._Fld740 > FROM _Document148 T1 > LEFT OUTER JOIN _Document148 T2 > ON (T1._IDRRef = T2._IDRRef) AND (T2._Fld376 = CAST(0 AS NUMERIC)) > WHERE ((T1._Fld376 = CAST(0 AS NUMERIC))) AND (((T2._Fld734RRef = > '\\237%\\014\\272J\\012\\005\\234B\\214\\177\\232/Ri\\350'::bytea) OR > (T2._Fld734RRef = > '\\244\\221k}F\\256\\031AML\\306!x\\376\\353\\234'::bytea)) AND > T1._Posted = TRUE AND (T1._Fld745RRef IN > ('\\274\\215\\364M0o\\375\\250\\021\\351C\\024Z(`\\236'::bytea)) AND > (((T1._Date_Time >= '2019-08-14 00:00:00'::timestamp) AND > (T1._Date_Time < '2019-09-10 23:59:00'::timestamp)) OR ((T1._Fld740 > > '2019-08-14 00:00:00'::timestamp) AND (T1._Fld740 <= '2019-09-10 > 23:59:00'::timestamp))) AND (T1._Fld733RRef = > '\\317\\200\\364M0o\\375\\250\\021\\351<\\016\\331\\310\\247\\022'::bytea) > AND (T1._Fld754RRef = > '\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000'::bytea)) > ORDER BY (T1._Date_Time) > > On Postges 9.6 and earlier works fine.... > > You can download DB dump from http://89.169.110.237/fitness1c.sql > > Let me know if you need any additional information > > Thank a lot... > Are you sure that you are not using PgPRO version of Postgres for 1C? It includes self join patch where the bug with similar symptoms was recently fixed. Please try to execute: set enable_self_join_removal=off; and repeat the query. If such GUC assignment works then you definitely have version of Postgres with self join patch. Unfortunately lack of this GUC doesn't mean that your version of Postgres doesn't include this optimization. "enable_self_join_removal" is available only in PgPRO-EE but not in patch published at commitfest. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company