I've been trying many things to get this to work. I've followed the documentation, as far as I know, and this is just not working.
Can any of you with experience in Postgres recommend a fix? I would be eternally grateful.
I'm using Version 1.18.1 (jun 9 2014, rev: REL-1_18_1)
My create code:
set search_path = PsychoProductions;
create or replace function fcn_insert_person(
-- person table
prm_role_id int,
prm_first_name text,
prm_last_name text,
prm_organization text,
prm_website text,
prm_default_billing_method_id text,
prm_active boolean,
-- address table
prm_address_type_id int,
prm_address text,
prm_city text,
prm_state text,
prm_zip_code text,
-- email table
prm_email_address text,
prm_email_type_id int,
-- phone table
prm_phone_number text,
prm_phone_type_id int
)
returns void as
$$
set search_patch = PsychoProductions;
insert into PsychoProductions.person (
role_id,
first_name,
last_name,
organization,
website,
default_billing_method_id,
active
)
values (
prm_role_id,
prm_first_name,
prm_last_name,
prm_organization,
prm_website,
prm_default_Billing_Method_ID,
prm_active
);
insert into PsychoProductions.address (
person_id,
address_type_id,
address,
city,
state,
zip_code
)
values (
( select currval('person_id_seq') ),
prm_address_type_id,
prm_address,
prm_city,
prm_state,
prm_zip_code
);
insert into email (
person_id,
email_address,
email_type_id
)
values (
( select currval('person_id_seq') ),
prm_email_address,
prm_email_type_id
);
insert into phone (
person_id,
phone_number,
phone_type_id
)
values (
( select currval('person_id_seq') ),
prm_phone_number,
prm_phone_type_id
);
-- end;
$$
language sql;
My execute/call code:
set search_path = PsychoProductions;
select fcn_insert_person(
-- NOTE: DO NOT REMOVE QUOTATION MARKS
-- person table
3, -- customer
'firstname',
'lastname',
'organization',
'website',
2, -- net 30
True, -- active
-- address table
1, -- unique
'address',
'city',
'state',
'zip',
-- email table
'email',
1, -- business email
-- phone table
'phone',
1 -- mobile
);
Error:
ERROR: function fcn_insert_person(integer, unknown, unknown, unknown, unknown, integer, boolean, integer, unknown, unknown, unknown, unknown, unknown, integer, unknown, integer) does not exist
LINE 2: select fcn_insert_person(
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
********** Error **********
ERROR: function fcn_insert_person(integer, unknown, unknown, unknown, unknown, integer, boolean, integer, unknown, unknown, unknown, unknown, unknown, integer, unknown, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 45