Hi,
I'm trying to use the APPROXIMATE_COUNT_DISTINCT function. When I execute this function with a superuser, it works fine. However, if I use a different user, I get this error reported from the Vertica driver.
ERROR: Function ApproxCountDistinct(int) does not exist, or permission is denied for ApproxCountDistinct(int)
When I query the v_catalog.user_functions table, I see the function does exists, with the following info:
procedure_type = User Defined Aggregate
function_argument_type = Integer
function_definition = Class 'ApproxCountDistinctFactory' in Library 'dbadmin.ApproximateLib'
schema_name = dbadmin
As per the Vertica documentation, I even granted EXECUTE permission on this aggregate function to that user. I even granted the USAGE permission to the schema.
From what I have witnessed, it seems like I need to somehow add an entry to the user_functions table for this same function, but have the schema be different (because I would like to run the function against data in a separate schema).
So it looks like I have to add this function using CREATE AGGREGATE FUNCTION, but this requires loading a library that contains the function. Since this is a built-in function, I don't know where it is located. So I can't run the required CREATE LIBRARY statement.
Basically, I have something like this:
CREATE OR REPLACE AGGREGATE FUNCTION db.schema.ApproxCountDistinct AS LANGUAGE 'C++' NAME 'ApproxCountDistinctFactory' LIBRARY 'dbadmin.ApproximateLib' (the name and library value I copied from the existing entry in user_functions table).
Does anyone know how I can use this built in function in the schema that I want? Am I going down the wrong path as stated above? What am I doing wrong?
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.