Re: numeric regression test passes, but why?

2018-01-11 Thread Chapman Flack
On 01/11/2018 11:23 AM, Alvaro Herrera wrote:
> Dagfinn Ilmari Mannsåker wrote:
>> ilm...@ilmari.org (Dagfinn Ilmari Mannsåker) writes:
>>
>>> The behaviour seems to have changed in 9.6:
>>
>> Indeed, https://www.postgresql.org/docs/current/static/release-9-6.html
>> has the following entry:
>>
>>  * Improve the accuracy of the ln(), log(), exp(), and pow() functions
>>for type numeric (Dean Rasheed)
> 
> Well, the test line was added with that commit (7d9a4737c268), and
> indeed its comment says this used to fail:
> 
> +-- cases that used to error out
> +select 0.12 ^ (-25);
> + ?column?  
> +---
> + 104825960103961013959336.4983657883169110
> +(1 row)

And indeed, my starting message in this thread was that, even in my
recent (e35dba475a440f73dccf9ed1fd61e3abc6ee61db) build, make check
*succeeds*, and for all I can tell, that test *is* executed (it shows
up in the log, and if I re-run it with digits altered, it fails).

And then I can connect interactively to the same server (started
fresh, not the same instance 'make check' was running, haven't tried
to find a way to connect to that), issue the same select, and get
the division by zero.

This is somehow sensitive to some sort of state. But what sort?

-Chap



Re: numeric regression test passes, but why?

2018-01-11 Thread Alvaro Herrera
Dagfinn Ilmari Mannsåker wrote:
> ilm...@ilmari.org (Dagfinn Ilmari Mannsåker) writes:
> 
> > The behaviour seems to have changed in 9.6:
> 
> Indeed, https://www.postgresql.org/docs/current/static/release-9-6.html
> has the following entry:
> 
>  * Improve the accuracy of the ln(), log(), exp(), and pow() functions
>for type numeric (Dean Rasheed)

Well, the test line was added with that commit (7d9a4737c268), and
indeed its comment says this used to fail:

+-- cases that used to error out
+select 0.12 ^ (-25);
+ ?column?  
+---
+ 104825960103961013959336.4983657883169110
+(1 row)

-- 
Álvaro Herrerahttps://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: numeric regression test passes, but why?

2018-01-11 Thread Chapman Flack
On 01/11/2018 07:44 AM, Sergei Kornilov wrote:
> Hello
> I am surprised, but i can confirm error on versions prior 9.6: on 9.5, 9.4, 
> 9.3 same error. On 9.6 and 10 query works correctly

One of my tests (in fact, the one where I first noticed) was a build
from git a couple days ago at e35dba475a440f73dccf9ed1fd61e3abc6ee61db
though.

-Chap



Re: numeric regression test passes, but why?

2018-01-11 Thread Dagfinn Ilmari Mannsåker
ilm...@ilmari.org (Dagfinn Ilmari Mannsåker) writes:

> The behaviour seems to have changed in 9.6:

Indeed, https://www.postgresql.org/docs/current/static/release-9-6.html
has the following entry:

 * Improve the accuracy of the ln(), log(), exp(), and pow() functions
   for type numeric (Dean Rasheed)

> $ psql -p5495
> Line style is unicode.
> Border style is 2.
> psql (10.1, server 9.5.10)
> Type "help" for help.
>
> ilmari@[local]:5495 ~=# select 0.12 ^ (-25);
> ERROR:  division by zero
> ilmari@[local]:5495 ~=# \q
>
> $ psql -p5496
> Line style is unicode.
> Border style is 2.
> psql (10.1, server 9.6.6)
> Type "help" for help.
>
> ilmari@[local]:5496 ~=# select 0.12 ^ (-25);
> ┌───┐
> │ ?column?  │
> ├───┤
> │ 104825960103961013959336.4983657883169110 │
> └───┘
> (1 row)
>
> ilmari@[local]:5496 ~=# \q
>
> - ilmari

-- 
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen



Re: numeric regression test passes, but why?

2018-01-11 Thread Sergei Kornilov
Hello
I am surprised, but i can confirm error on versions prior 9.6: on 9.5, 9.4, 9.3 
same error. On 9.6 and 10 query works correctly
All checked postgresql are x86_64 from postgresql debian repository: 
http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main

postgres=# select 0.5678::numeric operator(pg_catalog.^) (-85::numeric);
ERROR:  division by zero
postgres=# select version();
  version   
   
---
 PostgreSQL 9.5.10 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 
4.9.2, 64-bit

Regards, Sergei

11.01.2018, 15:27, "Chapman Flack" :
> On 01/11/18 02:07, Tom Lane wrote:
>
>>  Hm, it won't help your sanity to know that those cases pass fine
>>  for me, interactively, on a couple of different machines:
>>  ...
>>  You sure you're using a stock build of Postgres? No handmade
>>  versions of operator ^ lying around?
>
> Interesting thought
>
> At $work:
> postgresql95-server.x86_64 9.5.10-1PGDG.rhel7 @pgdg95
>
> postgres=> select 0.5678 operator(pg_catalog.^) (-85);
> ERROR: division by zero
> postgres=> select 0.5678::numeric operator(pg_catalog.^) (-85::numeric);
> ERROR: division by zero
>
> Also at home in a gentoo 9.5.1 ebuild...
> Also in a build from e35dba475a440f73dccf9ed1fd61e3abc6ee61db in git.
>
> All x86_64 
>
> -Chap



Re: numeric regression test passes, but why?

2018-01-11 Thread Dagfinn Ilmari Mannsåker
Tom Lane  writes:

> Chapman Flack  writes:
>> I see there are some tests in src/test/regress:
>> [ that don't work for me ]
>> Is there some special GUC setting in effect during the make check
>> that would be different in my ordinary session? What else could
>> be different? This is making me question my sanity.
>
> Hm, it won't help your sanity to know that those cases pass fine
> for me, interactively, on a couple of different machines:
>
> $ psql postgres
> psql (11devel)
> Type "help" for help.
>
> postgres=#  select 0.12 ^ (-25);
>  ?column?  
> ---
>  104825960103961013959336.4983657883169110
> (1 row)
>
> postgres=# select 0.5678 ^ (-85);
> ?column?
> 
>  782333637740774446257.7719390061997396
> (1 row)
>
> You sure you're using a stock build of Postgres?  No handmade
> versions of operator ^ lying around?

The behaviour seems to have changed in 9.6:

$ psql -p5495
Line style is unicode.
Border style is 2.
psql (10.1, server 9.5.10)
Type "help" for help.

ilmari@[local]:5495 ~=# select 0.12 ^ (-25);
ERROR:  division by zero
ilmari@[local]:5495 ~=# \q

$ psql -p5496
Line style is unicode.
Border style is 2.
psql (10.1, server 9.6.6)
Type "help" for help.

ilmari@[local]:5496 ~=# select 0.12 ^ (-25);
┌───┐
│ ?column?  │
├───┤
│ 104825960103961013959336.4983657883169110 │
└───┘
(1 row)

ilmari@[local]:5496 ~=# \q

- ilmari
-- 
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen



Re: numeric regression test passes, but why?

2018-01-11 Thread Chapman Flack
On 01/11/18 02:07, Tom Lane wrote:

> Hm, it won't help your sanity to know that those cases pass fine
> for me, interactively, on a couple of different machines:
> ...
> You sure you're using a stock build of Postgres?  No handmade
> versions of operator ^ lying around?

Interesting thought

At $work:
postgresql95-server.x86_64   9.5.10-1PGDG.rhel7  @pgdg95

postgres=> select 0.5678 operator(pg_catalog.^) (-85);
ERROR:  division by zero
postgres=> select 0.5678::numeric operator(pg_catalog.^) (-85::numeric);
ERROR:  division by zero

Also at home in a gentoo 9.5.1 ebuild...
Also in a build from e35dba475a440f73dccf9ed1fd61e3abc6ee61db in git.

All x86_64 

-Chap



Re: numeric regression test passes, but why?

2018-01-10 Thread Tom Lane
Chapman Flack  writes:
> I see there are some tests in src/test/regress:
> [ that don't work for me ]
> Is there some special GUC setting in effect during the make check
> that would be different in my ordinary session? What else could
> be different? This is making me question my sanity.

Hm, it won't help your sanity to know that those cases pass fine
for me, interactively, on a couple of different machines:

$ psql postgres
psql (11devel)
Type "help" for help.

postgres=#  select 0.12 ^ (-25);
 ?column?  
---
 104825960103961013959336.4983657883169110
(1 row)

postgres=# select 0.5678 ^ (-85);
?column?

 782333637740774446257.7719390061997396
(1 row)

You sure you're using a stock build of Postgres?  No handmade
versions of operator ^ lying around?

regards, tom lane