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 1gaBEc-0002UH-Si for pgsql-general@arkaria.postgresql.org; Fri, 21 Dec 2018 03:12:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gaBEb-0006e8-IE for pgsql-general@arkaria.postgresql.org; Fri, 21 Dec 2018 03:12:21 +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 1gaBEZ-0006dD-Js for pgsql-general@lists.postgresql.org; Fri, 21 Dec 2018 03:12:21 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gaBEW-0007aF-Js for pgsql-general@postgresql.org; Fri, 21 Dec 2018 03:12:18 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 144FC2298D; Thu, 20 Dec 2018 22:12:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 20 Dec 2018 22:12:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=n 3KKldSL3dVOxaxad6bomHaWeYbxWebWM1nMQDN3j2s=; b=0+Mj+V/vcZWzu5mky LAtnjMK9Vat1pB/cNA2PDoJd4YFdY9fnBdXUF5B+a5TlN/g25Rn56BeENfcwR9w+ oE/5Hwii834xAGA4oOZ5NpotCd2tGTlJYJVcGnnhhdN7c3ZB1y+X8LZwIOZVha0v GKegmbhHzupzwbdejMM8enxNqbhMt6KkQBfJjcBW41GRGhDCWI/Hqj/MM5kM/UMK o9HI3yGYWRP5v7dVxmPsHXRDrgI3OKnE/VIHFlk7LMQJx2w67PNC39vnIR+w8b2E nOGJHfnRZwosGEB6KgyJDxcHyekYvxlxszXivQgpAztJpCC+eMxhhznA6kYvVlG8 0q8+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=n3KKldSL3dVOxaxad6bomHaWeYbxWebWM1nMQDN3j 2s=; b=SF/wYZ/Xi2H6RyOzKdNfKZc0TlINZF1nqS5k8ts3sAXq3BFjBRDvF6kPz GhUfkI7KWd0ks3Ag/VvsYb+u2AEAYq6zQCck5YdkXbCghfTA04uz6CLhxDW9j4on bQ7i9GxyMkjJofpyeaXjiEf8TRLq8k1ZpXsbgn8aw5q547rtz6ovch0Temp/qO14 B2QAmJ76dz67Sj5NRvbiJG5ogtm8wlsElQSJYz8nElu3hQHjZNjQi4OpvXYGfaya 5KirMZavRYF5Yy323EPcC0X606Z8j/Gg1rT9X7e8hJd0tY4OnZzcYS9+ysesSjHC 3nyxkXCFEgStxXvemB/oMEEdUkAxg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudejgedgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejuddrvd duvddrudefgedrfeenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.2] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id 37630E4445; Thu, 20 Dec 2018 22:12:14 -0500 (EST) Subject: Re: Change from 9.6 to 11? To: Chuck Martin References: Cc: pgsql-general From: Adrian Klaver Message-ID: <37b96fd6-c5f5-e1d3-6284-6f1521a02638@aklaver.com> Date: Thu, 20 Dec 2018 19:12:13 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/20/18 5:51 PM, Chuck Martin wrote: Please reply to list also. Ccing list. > > > On Thu, Dec 20, 2018 at 7:56 PM Adrian Klaver > wrote: > > On 12/20/18 12:35 PM, Chuck Martin wrote: > > I hope someone here can see something that eludes me. I've recently > > moved a database from PostgreSQL 9.6 to 11, and there are a few > > oddities. The following select statement returns zero rows when it > > should return one. This is one of a small number of records that > exist, > > but are not returned by the query. When I include the main table, > event, > > and any one of the associated tables, the record is returned, but no > > record is returned with the entire statement. All the primary keys > > (_pkey) and foreign keys (_fkey) are integers. The field I > suspect as > > the possible culprit, event.InsBy, is a character column I'm > converting > > to do a lookup on a primary key (integer): event.InsBy::int = > > usr.Usr_pkey. Maybe PG 11 doesn't recognize the same syntax for > cast as > > PG 9.6? Or maybe I'm overlooking something else basic. Thanks for > reading! > > So if in the WHERE you leave out the: > > AND event.InsBy::int = usr.Usr_pkey > > and in the SELECT you add: > > event.InsBy, event.InsBy::int AS InsByInt > > what do you see? > > > I get 91 copies of the record. One for each record in the usr table. But do the event.InsBy, event.InsBy::int AS InsByInt values match each other? Just had a thought, what if you join just the event and usr tables on: event.InsBy::int = usr.Usr_pkey Trying to determine whether your suspected culprit really is the culprit. -- Adrian Klaver adrian.klaver@aklaver.com