Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Bugs > Re: BUG #4113: ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 3722 of 4088
Post > Topic >>

Re: BUG #4113: server closed the connection unexpectedly

by tgl@[EMAIL PROTECTED] (Tom Lane) Apr 21, 2008 at 01:09 PM

Alvaro Herrera <alvherre@[EMAIL PROTECTED]
> writes:
> Javier Hernandez wrote:
>> select * from numeric_col_table where num_col in (select int_col from
>> int_col_table);

> So what's happening here is that it's writing the hash table using the
> wrong datatype ...

Yeah, the planner is at fault here --- it should be coercing the value
to numeric before ha****ng.  I think this is wrong all the way back,
but pre-8.3 you'd have silently gotten wrong answers instead of a crash,
because the executor made up its own mind about how to unique-ify the
subquery outputs, and it looked directly at their actual data type
and chose some default equality operator for that.  This can be
demonstrated to be the Wrong Thing when the conversion to the IN
operator's datatype is lossy, as in this variant example:

create table numeric_col_table (
num_col numeric
);

create table float_col_table (
float_col float8
);

insert into numeric_col_table values (1), (1.000000000000000000001), (2),
(3);

insert into float_col_table values (1), (2), (3);

select * from numeric_col_table;

select * from float_col_table;

select * from float_col_table where float_col in (select num_col from
numeric_col_table);

In 8.2 I get bogus results like

 float_col 
-----------
         1
         1
         2
         3
(4 rows)

because 1 and 1.000000000000000000001 are perfectly distinct numeric
values, but not so much after they've been coerced to float.

In 8.3/HEAD I think this can be fixed by coercing the Vars that are put
into the InClauseInfo entry for the IN join.  Not sure how far back it
will be practical to apply that fix, though.

			regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
 




 5 Posts in Topic:
BUG #4113: server closed the connection unexpectedly
dba@[EMAIL PROTECTED] (&  2008-04-18 20:15:50 
Re: BUG #4113: server closed the connection
bruce@[EMAIL PROTECTED]   2008-04-21 11:42:37 
Re: BUG #4113: server closed the connection unexpectedly
alvherre@[EMAIL PROTECTED  2008-04-21 11:53:53 
Re: BUG #4113: server closed the connection unexpectedly
tgl@[EMAIL PROTECTED] (T  2008-04-21 13:09:39 
Re: BUG #4113: server closed the connection unexpectedly
tgl@[EMAIL PROTECTED] (T  2008-04-21 16:55:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 12:57:46 CDT 2008.