CREATE OR REPLACE FUNCTION insert_test (
  integer,   -- personid
  boolean,   -- headtracking
  boolean,   -- stereo
  boolean,   -- shadow
  integer    -- boxsizeid
) RETURNS integer AS $$
DECLARE
  par_personid     ALIAS FOR $1;
  par_headtracking ALIAS FOR $2;
  par_stereo       ALIAS FOR $3;
  par_shadow       ALIAS FOR $4;
  par_boxsizeid    ALIAS FOR $5;

  var_testid       integer;
BEGIN
  INSERT INTO tbl_test (
    personid,
    headtracking,
    stereo,
    shadow,
    boxsizeid
  ) VALUES (
    par_personid,
    par_headtracking,
    par_stereo,
    par_shadow,
    par_boxsizeid
  );

  SELECT INTO var_testid seq_test.last_value;

  RETURN var_testid;
END;
$$ LANGUAGE plpgsql;