[BUGS] BUG #1888: bug in cast from float4 to float8

2005-09-17 Thread Pablo Oses

The following bug has been logged online:

Bug reference:  1888
Logged by:  Pablo Oses
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.0.x and 7.2.x
Operating system:   redhat, slackware and win32
Description:bug in cast from float4 to float8
Details: 

this is *really* simple

execute something like this:
select cast(123.456::float4 as float8)

what do you think its the answer ? 123.456 ?

well pgsql 7.2.2, 8.0.0, 8.0.1 and 8.0.3 (all i have used) answers this:
123.456001281738 which is WRONG

bye and thanks for a wonderfull contribution for the free software comunity

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [BUGS] BUG #1886: Bug in SQL parsing

2005-09-17 Thread Pete Beck

Well spotted! :-)
It looks like the bug must actually be with Hibernate, which generated 
the offending code.


I'll take it up with those guys.

Thanks for your help!

Pete

Stephan Szabo wrote:

On Fri, 16 Sep 2005, Pete Beck wrote:



The following bug has been logged online:

Bug reference:  1886
Logged by:  Pete Beck
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.0.1 & 8.0.3
Operating system:   Linux and Windows
Description:Bug in SQL parsing
Details:

Postgres incorrectly reports a relation is being missing in a SQL.

The following query reports:

ERROR:  relation "product0_" does not exist



I believe this error is correct.

It looks to me like you have:
A Left join B on condition, C left join D on condition2
where condition2 refers to A.

IIRC, in standard SQL, the scope for condition contains A and B and the
scope for condition2 contains C and D but not A.



---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


Re: [BUGS] BUG #1888: bug in cast from float4 to float8

2005-09-17 Thread Tom Lane
"Pablo Oses" <[EMAIL PROTECTED]> writes:
> select cast(123.456::float4 as float8)

> what do you think its the answer ? 123.456 ?

> well pgsql 7.2.2, 8.0.0, 8.0.1 and 8.0.3 (all i have used) answers this:
> 123.456001281738 which is WRONG

This is not a bug.  Please go learn something about floating-point
arithmetic (or if you don't care to, use type numeric instead).

regards, tom lane

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [BUGS] BUG #1888: bug in cast from float4 to float8

2005-09-17 Thread Michael Fuhr
On Sat, Sep 17, 2005 at 04:00:50AM +0100, Pablo Oses wrote:
> select cast(123.456::float4 as float8)
> 
> what do you think its the answer ? 123.456 ?
> 
> well pgsql 7.2.2, 8.0.0, 8.0.1 and 8.0.3 (all i have used) answers this:
> 123.456001281738 which is WRONG

Float4 has a precision of only about 6 digits, so you can't assume
much about the digits beyond that.  See the documentation for
floating-point types:

http://www.postgresql.org/docs/8.0/interactive/datatype.html#DATATYPE-FLOAT

This is hardly a behavior unique to PostgreSQL; use a search engine
to find explanations of the problems of using binary floating-point
numbers.

If you need exact results then use the numeric type.

-- 
Michael Fuhr

---(end of broadcast)---
TIP 6: explain analyze is your friend


[BUGS] BUG #1889: little documentation error

2005-09-17 Thread Evgeny Gridasov

The following bug has been logged online:

Bug reference:  1889
Logged by:  Evgeny Gridasov
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.1
Operating system:   n/a
Description:little documentation error
Details: 

http://developer.postgresql.org/docs/postgres/manage-ag-tablespaces.html
see the text:
--
 To define a tablespace, use the CREATE DATABASE  command, for example:

CREATE TABLESPACE fastspace LOCATION '/mnt/sda1/postgresql/data';
--
i guess the text should be "use the CREATE TABLESPACE" command =)

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [BUGS] BUG #1889: little documentation error

2005-09-17 Thread Tom Lane
"Evgeny Gridasov" <[EMAIL PROTECTED]> writes:
> see the text:
>  To define a tablespace, use the CREATE DATABASE  command, for example:
> CREATE TABLESPACE fastspace LOCATION '/mnt/sda1/postgresql/data';

> i guess the text should be "use the CREATE TABLESPACE" command =)

Yup --- thanks for catching it!

regards, tom lane

---(end of broadcast)---
TIP 6: explain analyze is your friend