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 1ga97P-0004Re-GC for pgsql-general@arkaria.postgresql.org; Fri, 21 Dec 2018 00:56:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ga97M-0006Kg-6v for pgsql-general@arkaria.postgresql.org; Fri, 21 Dec 2018 00:56:44 +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 1ga97L-0006KY-6j for pgsql-general@lists.postgresql.org; Fri, 21 Dec 2018 00:56:43 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ga97H-0008SZ-DT for pgsql-general@postgresql.org; Fri, 21 Dec 2018 00:56:42 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D588521F01; Thu, 20 Dec 2018 19:56:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 20 Dec 2018 19:56:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=x yl8wO70ZOkn4izusjj9l61wfyUk/gMrgXWvpqqUn6Q=; b=5V7/cFL8x8TtRWycd Eo+cJ1lccL9bnjaEElUvfkunO8NS0s1tnmTvp7Pu5bfubexlcEf2RMAw5PUBQBki dNMv3AOSfs5M/I4/rz4GLz9bL3xnaaZMrcbn1pFkCYeDy1NfZFx25S1TlK7EHPXF /Y1fG3dIglgbiQlgC3XN6oQruVpFPnq2KfuxphTldExUdBiHbNW+2ZXukB4QCVZS 5CNZR+QaMZeRT1LJXfP2VISv7mKui1g7lDVzkZxENkLuLrHGv9yZrwWgPrO0Cwdu Kp7oemdcEr5AvKwVqZG1Esu+ZuUuLIVxN18ItlgUw5nwCm7haofpx7WWGaDTVF3S kJIlg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=xyl8wO70ZOkn4izusjj9l61wfyUk/gMrgXWvpqqUn 6Q=; b=RUlf+b3SMbLaZrYYWErZK6at3qkzFHBTCA7hJsH4w/XTUIQX2TN+cgYa6 lsB2LdszglUa66Q+W0uHKjfPlNnmj5GNprBDdYEK9d6W2DRO2uZF3Cj5/c8XpzwG 9m0sjJq5UOIk4Cy4pSCRJVB6QMwsnZLDX7xf66Tz3ixloZrmZhmeTGXvpsrjNv5J 2E9A4MmXYzofthbirSBW06nbhNofSd4KcJ284byZdukAcwj5WaIfYedHAdf9XVG/ rrpLBgAtwM/jTWnh37dcu/BqCJkORvI/wb8w/5D2lktMcmXHyjnw1hOd1+3ZMO9C PcaJXXqWCElajZJGBvzo9tha8bttg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudejgedgvdehucetufdoteggodetrfdotf 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 BBD5BE4472; Thu, 20 Dec 2018 19:56:36 -0500 (EST) Subject: Re: Change from 9.6 to 11? To: Chuck Martin , pgsql-general References: From: Adrian Klaver Message-ID: Date: Thu, 20 Dec 2018 16:56:35 -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 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? > > SELECT > event.Event_pkey,ombcase.CaseName,status.StatusID,eventtype.EventTypeID,event.datetime > AT TIME ZONE 'US/Eastern',event.endtime AT TIME ZONE > 'US/Eastern',event.EventDeadline,eventtype.EventIsDeadline,eventtype.OnCalendar,event.EventConfirmed,event.Description,event.PrivateNote,primaryresp.PrimaryrespID,event.IsPrivate,event.Hours,event.EventDone,event.EventDoneDate,event.Importance,event.Urgency,event.InCourt,event.LeadTime,doc.DocID,doctype.DocTypeID,project.ProjectName,usr.UserID,eventtype.Hours,event.Active,event.EditNum,event.InsBy,event.InsDateTime,event.ModBy,event.ModDateTime,event.Case_fkey,event.Eventtype_fkey,event.Project_fkey,event.Doc_fkey,event.Primaryresp_fkey,project.Project_pkey,primaryresp.PrimaryrespHolidayGroup,primaryresp.Usr_pkey,backup.Usr_pkey,doctype.Doctype_pkey,primaryresp.Primaryrespbackup_fkey,ombcase.Status_fkey,event.Parentevent_fkey,event.EventPostRemand > > FROM > event,ombcase,status,eventtype,primaryresp,doc,doctype,project,usr,backup > WHERE event.Case_fkey = Case_pkey > AND event.Eventtype_fkey = Eventtype_pkey > AND event.Project_fkey = Project_pkey > AND event.Primaryresp_fkey = primaryresp.Usr_pkey > AND event.Doc_fkey = Doc_pkey > AND Doctype_fkey = Doctype_pkey > AND usr.Backup_fkey = backup.Usr_pkey > AND ombcase.Status_fkey = status.Status_pkey > AND event.InsBy::int = usr.Usr_pkey > AND event.Event_pkey = 1060071 > ORDER BY EventDone, DateTime DESC > > Chuck Martin > Avondale Software -- Adrian Klaver adrian.klaver@aklaver.com