Bug fix

From: Michael Davis <mdavis(at)sevainc(dot)com>
To: "'pgsql-patches(at)postgresql(dot)org'" <pgsql-patches(at)postgresql(dot)org>
Subject: Bug fix
Date: 2000-12-16 00:05:48
Message-ID: 01C066BA.DCD59930.mdavis@sevainc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

This is a code patch for the following TODO items list under the "Types"
heading:

* SELECT col FROM tab WHERE numeric_col = 10.1 fails
* Allow better handling of numeric constants, type conversion [typeconv]

Description of this change:

Currently when the parsers finds more than one candidate to resolve an
expression, it returns no solution. This patch tells the parse to return
the first solution when more than one solution exists. This may fix many
small issues with expressions in where clauses.

This patch is needed for Access 97 to proper work with numeric data types.

How to duplicate the problem:
create table tst (id int, amount numeric(9,2));
insert into tst values (1, 1.10);
insert into tst values (2, 1.00);
insert into tst values (2, 2.00);
select * from tst where amount = 1; -- should work
select * from tst where amount = 1.1; -- should fail (before this
patch)
select * from tst where amount = 1.10; -- should fail (before this
patch)
select * from tst where amount = 1.0; -- should fail (before this
patch)
select * from tst where amount = 1.00; -- should fail (before this
patch)

Here is the result of a cvs diff:

RCS file:
/home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_oper.c,v
retrieving revision 1.45
diff -r1.45 parse_oper.c
535c535,538
< if (ncandidates == 1)
---
> /* Michael J Davis, 12/15/2000, since there is more than one canidate,
> lets return the first canidate rather than returning no canidate
> */
> if (ncandidates >= 1)

Thanks,

Michael Davis
Database Architect and Senior Software Engineer, Seva Inc.
Office: 303-460-7360 Fax: 303-460-7362
Mobile: 720-320-6971
Email: mdavis(at)sevainc(dot)com

Browse pgsql-patches by date

  From Date Subject
Next Message Max Khon 2000-12-16 09:10:04 Re: Re: more odbc patches
Previous Message Tom Lane 2000-12-15 19:46:34 Planner speedup diffs