0

When I attempt to run following query on a double column:

SELECT stddev_samp(col1) FROM t1

I get:

Error: SELECT: no such unary operator 'stddev_samp(double)'
SQLState:  22000
ErrorCode: 0

If I run it against an int column, I get:

Error: SELECT: no such unary operator 'stddev_samp(int)'
SQLState:  22000
ErrorCode: 0

And I am getting the same type of error when I attempt to execute any of the stat_func mentioned at: https://www.monetdb.org/Documentation/SQLreference/StatisticFunctions

It looks like if I didn't install support for statistic functions because otherwise MonetDB works well. Is there a procedure how to add statistic functions?

Background knowledge:

  1. Version: MonetDB Database Server Toolkit v1.1 (Oct2014-SP2)

  2. OS: OS X 10.9.5

  3. The database was installed from archive: MonetDB-11.19.9-x86_64-Darwin-9-bin.tar.bz2

user824276
  • 617
  • 1
  • 7
  • 20

2 Answers2

3

This is what worked for me:

Option 1) try using

SYS.STDDEV_SAMPLE ()
SYS.MEDIAN ()

etc... instead of "plain"

STDDEV_SAMPLE ()
MEDIAN ()

Option 2) (not recommended):

Work with the user named monetdb.

mins
  • 6,478
  • 12
  • 56
  • 75
alybel
  • 500
  • 3
  • 13
  • The trick with "sys." prefix worked. Out of curiosity I also tried to use "monetdb" user, but the statistical functions still require "sys." prefix. Since I can live the prefix, your post answers my question. Thanks. – user824276 Apr 12 '15 at 15:53
1

this code works fine. it will be difficult to help you troubleshoot until you provide a complete reproducible example. :)

CREATE TABLE t1 ( col1 INT, col2 DOUBLE ); 
INSERT INTO t1 VALUES ( 1 , 3 ) , ( 2.0 , 4.0 ) ;
SELECT stddev_samp( col1 ) FROM t1 ;
SELECT stddev_samp( col2 ) FROM t1 ;
SELECT stddev_pop( col1 ) FROM t1 ;
SELECT stddev_pop( col2 ) FROM t1 ;
Community
  • 1
  • 1
Anthony Damico
  • 5,779
  • 7
  • 46
  • 77