I want to insert an user and get its id e.g. last insert id. through sql.
CREATE OR REPLACE FUNCTION create_user(registration_ip inet)
RETURNS integer AS
insert into users(registration_ip)
values($1);
select max(id) from users;
LANGUAGE sql VOLATILE
Is this function secure ? I meant is it concurrency safe ? e.g. n users are being created concurrently is it guaranteed that it will return the current user's id ?