pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Chuck Martin <clmartin@theombudsman.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Change from 9.6 to 11?
Date: Thu, 20 Dec 2018 19:12:13 -0800
Message-ID: <37b96fd6-c5f5-e1d3-6284-6f1521a02638@aklaver.com> (raw)
In-Reply-To: <CAFw6=U0h38=StQUX86XLtgpCZdch0N0wL9ug0epnFx4TgY6sXw@mail.gmail.com>
References: <CAFw6=U1jYhUD+E7u47Jxhs6Ta9-EkhFxcJnZPHvbj1OW-X9ynw@mail.gmail.com>
	<e0897af4-58af-658c-8746-96fc02e55700@aklaver.com>
	<CAFw6=U0h38=StQUX86XLtgpCZdch0N0wL9ug0epnFx4TgY6sXw@mail.gmail.com>

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 <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.com>> 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




view thread (6+ messages)  latest in thread

Message-ID: <37b96fd6-c5f5-e1d3-6284-6f1521a02638@aklaver.com>
Permalink:  ../37b96fd6-c5f5-e1d3-6284-6f1521a02638@aklaver.com/
Also on:    postgresql.org/message-id/37b96fd6-c5f5-e1d3-6284-6f1521a02638@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, clmartin@theombudsman.com
  Subject: Re: Change from 9.6 to 11?
  In-Reply-To: <37b96fd6-c5f5-e1d3-6284-6f1521a02638@aklaver.com>
  References: <CAFw6=U1jYhUD+E7u47Jxhs6Ta9-EkhFxcJnZPHvbj1OW-X9ynw@mail.gmail.com> <e0897af4-58af-658c-8746-96fc02e55700@aklaver.com> <CAFw6=U0h38=StQUX86XLtgpCZdch0N0wL9ug0epnFx4TgY6sXw@mail.gmail.com> <37b96fd6-c5f5-e1d3-6284-6f1521a02638@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox