powa-team / powa-archivist

powa-archivist: the powa PostgreSQL extension
http://powa.readthedocs.io/
PostgreSQL License
51 stars 20 forks source link

Spelling error in powa--4.0.0beta1.sql - extension will not load #28

Closed optimadba closed 4 years ago

optimadba commented 4 years ago

Create extension powa fails as below:

postgres=# create extension powa
postgres-# ;
ERROR:  "res.mean_err_estimate_num" is not a known variable
LINE 10:     res.mean_err_estimate_num = a.mean_err_estimate_num - b....
             ^
QUERY:  
DECLARE
    res powa_qualstats_history_diff;
BEGIN
    res.intvl = a.ts - b.ts;
    res.occurences = a.occurences - b.occurences;
    res.execution_count = a.execution_count - b.execution_count;
    res.nbfiltered = a.nbfiltered - b.nbfiltered;
    res.mean_err_estimate_ratio = a.mean_err_estimate_ratio - b.mean_err_estimate_ratio;
    res.mean_err_estimate_num = a.mean_err_estimate_num - b.mean_err_estimate_num;

    return res;
END;

Traced it to the following piece of code in powa--4.0.0beta1.sql (line numbers included for reference) - line 1346 should read mean_err_estimate_num

   1339 /* pg_qualstats operator support */
   1340 CREATE TYPE powa_qualstats_history_diff AS (
   1341     intvl interval,
   1342     occurences bigint,
   1343     execution_count bigint,
   1344     nbfiltered bigint,
   1345     mean_err_estimate_ratio double precision,
   1346     mean_err_estimate_nun double precision
   1347 );
rjuju commented 4 years ago

Oops, thanks a lot for reporting!

Unfortunately pg 10 and above don't complain anymore for this kind of mistake, so I totally missed it. Commit https://github.com/powa-team/powa-archivist/commit/79329c77b2e4d3fe82e1b071ebe47a53fba43a58 fixes the issue, and I can install the ewtension on a pg 9.6 version!