Hi,
I would sometimes need a lot of parameters, even 100 or so. These would be
the data access functions for tables. I know the default count limit is 32,
and FUNC_MAX_ARGS compile option should be set to, say, 256.
But I have another option, a bit harder, I could pass the parameters in a
record type. Passing parameters such way is a problematic because the
provider I would use does not support it yet.
My question is that is the second method faster?
Simple example:
create table person(id serial primary key, name text not null, address
text);
--First option:
create function person_ins(_name text, _address text) -- <<------
returns person
language plpgsql
as
$$
declare
inserted_row person;
begin
--insert row
insert into person (name, address) values (_name, _address); -- <<-----
--retrieve inserted row
select into inserted_row * from person where
id=currval('person_id_seq'::text);
--return with it
return inserted_row;
end;
$$;
--Second option:
create function person_ins(_person person) -- <<----
returns person
language plpgsql
as
$$
declare
inserted_row person;
begin
--insert row
insert into person (name, address) values (_person.name,
person.address); -- <<------
--retrieve inserted row
select into inserted_row * from person where
id=currval('person_id_seq'::text);
--return with it
return inserted_row;
end;
$$;
I hope there are no syntax errors.
Of course in a real application I would have a lot more parameters.
Best Regards,
Otto