0

I want to use the optimizer_stats function like:

select optimizer_stats();

And it returns

SELECT: no such operator 'optimizer_stats'

But I can find it in the sys.functions table (id=5976).

Also I find the UDF like reverse(string) can't be used too:

sql>select reverse('abc');
SELECT: no such unary operator 'reverse(char)'

So what's the problem?

Alan
  • 3
  • 2

1 Answers1

0

Functions in MonetDB are bound in schemas. You cannot find those functions because your current schema is not 'sys'. Either change your session schema to 'sys' or use the full path (e.g. sys.reverse('abc')).

In default branch (next feature release) I added a 'search path' variable to search at other schemas when a SQL object cannot be found. By default it includes the 'sys' schema.

PedroTadim
  • 71
  • 3
  • I change to **select sys.reverse('abc')**, but still : SELECT: no such unary operator 'reverse(char)'. And sys.functions table is available. – Alan Jan 13 '21 at 09:22
  • @Alan, can you rewrite your question as a script that can be run with a clean database server? – Yunus King Jan 13 '21 at 12:35
  • Do you mean `select sys.reverse('abc');` or something else? – Alan Jan 13 '21 at 13:01
  • Well we tried it out on a clean system and it just works for us. So that is what we mean with a clean reproduction script. – Yunus King Jan 13 '21 at 14:22
  • After the installation of MonetDB from source, I just follow the tutorial of MonetDB to create a new dbfarm and a new database. Then I connect to that database and want to test whether the UDF can be used. I didn't do anything else. – Alan Jan 15 '21 at 09:31