From: Tom Lane <tgl@sss.pgh.pa.us>
To: vjchem@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14398: Order of Joins results in different results returned
Date: Wed, 26 Oct 2016 17:52:16 -0400
Message-ID: <8758.1477518736@sss.pgh.pa.us> (raw)
In-Reply-To: <20161026204925.1411.76992@wrigleys.postgresql.org>
References: <20161026204925.1411.76992@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
vjchem@gmail.com writes:
> This appears to ultimately be a casting issue, but it was surprising to us
> and thus I thought I'd file a bug report. I have a query that has two JOINs,
> where each JOIN uses parameters $1 and $2. The order of the JOIN changes the
> results returned. I can get the results I expect by explicitly casting $1
> and $2 or by changing the order of the JOINs. Is this expected behavior? It
> feels like I should get an error if the casting is ambiguous or that the
> order of the JOINs should not change the results.
I think the point is that you've got two separate uses of $1 and $2
in contexts that will lead to different conclusions about what their
types are (date or timestamptz, respectively). Whichever one the
parser comes to first will determine its choice, and the other context
is not so incompatible as to result in an error; nor is the provided
input string. But you'll get different results depending on that
choice.
Yes, it's ambiguous, but throwing an error would probably not make
more people happy than it makes unhappy.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, vjchem@gmail.com
Subject: Re: BUG #14398: Order of Joins results in different results returned
In-Reply-To: <8758.1477518736@sss.pgh.pa.us>
References: <20161026204925.1411.76992@wrigleys.postgresql.org> <8758.1477518736@sss.pgh.pa.us>
* 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