pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stepya@ukr.net
To: pgsql-bugs@postgresql.org
Subject: BUG #14008: corr, covar_pop function returns different values on the same dataset
Date: Wed, 09 Mar 2016 13:39:03 +0000
Message-ID: <20160309133903.6674.13709@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14008
Logged by:          Stepan
Email address:      Stepya@ukr.net
PostgreSQL version: 9.5.1
Operating system:   RedHat Linux 64-bit
Description:        

Aggregation functions line corr, covar_pop returns different values
depending on sorting order of the dataset. The issue is reproducible on
PostgreSQL version 9.5.0 and 9.5.1.

See script how to reproduce it.

  drop table if exists t ;
  drop table if exists t2 ;

   create table T
   (pk bigint,
    fk bigint);
    
    insert into T select generate_series as PK,
floor(random()*(567890-10)+10) as FK 
    from generate_series(551475,551475+1000000);
    
-- Create table with the same data but different sorting order    
create table T2
    as select *
    from T order by 1 desc;
    

    select count(1), stddev(PK), stddev(FK), covar_pop(pk, fk)
    from T
    UNION ALL
    select count(1), stddev(PK), stddev(FK), covar_pop(pk, fk)
    from T2;
-- Last column only returns different values!!!!


-- To be sure both tables contain the same data.
    select pk, fk
    from T
    except 
    select pk, fk
    from T2;
--Returns 0 rows

    select pk, fk
    from T2
    except 
    select pk, fk
    from T;
--Returns 0 rows


Stepan.



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



view thread (2+ messages)  latest in thread

Message-ID: <20160309133903.6674.13709@wrigleys.postgresql.org>
Permalink:  ../20160309133903.6674.13709@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160309133903.6674.13709@wrigleys.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: Stepya@ukr.net
  Subject: Re: BUG #14008: corr, covar_pop function returns different values on the same dataset
  In-Reply-To: <20160309133903.6674.13709@wrigleys.postgresql.org>
  References: <20160309133903.6674.13709@wrigleys.postgresql.org>

* 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