0

I've run into a problem I couldn't find a solution to.

I've successfully created a function. Here's the function name and arguments:

CREATE OR REPLACE FUNCTION app_private.create_user(username citext, email text, email_is_verified boolean, name text, avatar_url text, title text DEFAULT NULL::text, color character varying DEFAULT NULL::character varying, user_role smallint DEFAULT 0, password text DEFAULT NULL::text)
RETURNS app_public.users
....
CREATE FUNCTION

I've also successfully granted privilege to execute the function to a role. AND also created a comment:

grant execute on function app_private.create_user(username citext, email text, email_is_verified bool, name text, avatar_url text, title text, color varchar(7), user_role smallint, password text) to nine_manager;
GRANT    
comment on function app_private.create_user(username citext, email text, email_is_verified bool, name text, avatar_url text, title text, color varchar(7), user_role smallint, password text) is  
    E'Creates a user account.';
COMMENT

however, when I try to create a test user by querying:

SELECT "app_private.create_user"('JS0'::citext, 'test@gmail.com'::text, true::boolean, 'John Smith'::text, 'SY'::text, 'Manager'::text, '#000000'::varchar(7), 5::SMALLINT, 'test'::text);

I get an error:

ERROR: function app_private.create_user(citext, text, boolean, text, text, text, character varying, smallint, text) does not exist
LINE 1: SELECT "app_private.create_user"('SY0'::citext, 'test@gmail....

I've tried changing the queries and casts but failed. Nearly pulling my hair out.

Thank you ahead of time.

saeed foroughi
  • 1,662
  • 1
  • 13
  • 25
Real Yang
  • 3
  • 1
  • 2
  • 3
    `SELECT "app_private"."create_user"` or remove all those dreaded double quotes completely –  Jan 28 '20 at 10:27
  • That did the trick. Thank you. I read somewhere to add double quotes for names with a period in between, oops! – Real Yang Jan 28 '20 at 17:40

1 Answers1

1

Remove double qoutes before calling your function in select as below

     Select app_private.create_user(....)
      From table;
Himanshu
  • 3,830
  • 2
  • 10
  • 29