From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: problem: index on number not honoured
Date: Thu, 15 Nov 2001 11:29:41 -0600
Message-ID: <20011115112941.B2518@rice.edu> (raw)
In-Reply-To: <9spaa8$inv$1@news.tht.net>
References: <9spaa8$inv$1@news.tht.net>
This is an instance of a known problem: numeric constants get resolved to
'float8' during the parsing stage, so the planner doesn't know it can
use the 'int2' (or whatever) index for this query. The 'string like'
constants (i.e. anything quoted with ') are kept as 'unknown' until the
last stages, when the planner can then attempt to resolve them to match
the type of the underlying column/index.
It is interesting to see your comments regarding the JDBC interface: I
haven't seen that angle reported before. To date, it's been a matter of
suggesting workarounds to individual cases. The correct solution i(which
has arisen out of discussion on the HACKERS list: I think it's Tom Lane's
idea) is probably to come up with the concept of an 'unknown numeric'
constant, and treat it like the string constant gets treated. We've seen
a rash of these problems recently: unfortunately, this isn't fixed in
7.2 (which is in Beta 2 right now: should go Release Candidate1 tomorrow),
but I'd suggest it's a candidate for fixing early in 7.3. Might even
be argued as a 'bug fix', but the changes needed to fix this right are
probably so extensive that it'll never go into a stable release.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: reedstrm@rice.edu, pgsql-hackers@postgresql.org
Subject: Re: problem: index on number not honoured
In-Reply-To: <20011115112941.B2518@rice.edu>
* 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