JeyJ
JeyJ

Reputation: 4070

postgresql schemas conflict

I created new database named test1, new user test1_user and i granted all on database test1 to test1_user. Moreover, I created schema test1_user. Now, I also created new schema functions_package and its owner is test1_user.

my code :

CREATE OR REPLACE FUNCTION functions_package.newFunction(file_id     
utl_file.file_type) RETURNS VOID AS $body$
 BEGIN
 functions_package.old_function1(file_id);
 functions_package.old_function2(file_id);
 functions_package.old_function3(file_id);

 End;
 --
 $body$
 LANGUAGE PLPGSQL
 SECURITY DEFINER
 STABLE;

I created few functions under schema functions_package and now I`m trying to create new function that uses the old functions but im getting eror :

ERROR:  syntax error at or near "functions_package"
LINE 3:    functions_package.old_function('aa');

IM trying to create the new function from user test1_user; Im getting this error for every function in schema functions_package that i`m trying to summon in my new function. In all the old function I didnt summon any function at all so i didnt have this kind of error. Some help ?

Upvotes: 1

Views: 103

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51599

you lack select before function name: try:

CREATE OR REPLACE FUNCTION functions_package.newFunction(file_id     
utl_file.file_type) RETURNS VOID AS $body$
 BEGIN
 perform functions_package.old_function1(file_id);
 perform functions_package.old_function2(file_id);
 perform functions_package.old_function3(file_id);

 End;
 --
 $body$
 LANGUAGE PLPGSQL
 SECURITY DEFINER
 STABLE;

Upvotes: 2

Related Questions