Postgres 8.4 Create Function

Hi All
I'm trying to have Hipergate (www.hipergate.org) to run
After the installation I can not login
It seems that a function, which checks the user name and password dose not exist on the database
When looking at the source code of hipergate, I found the following script, which is generating the missing function.
 
CREATE FUNCTION k_sp_autenticate (CHAR, VARCHAR) RETURNS SMALLINT AS '

DECLARE
    Password  VARCHAR;
    DtCancel  TIMESTAMP;
    DtExpire  TIMESTAMP;
    Activated SMALLINT := NULL;
    CoStatus  SMALLINT := 1;

BEGIN
  SELECT tx_pwd,bo_active,dt_cancel,dt_pwd_expires INTO Password,Activated,DtCancel,DtExpire FROM k_users WHERE gu_user=$1;

  IF Activated IS NULL THEN

    CoStatus := -1;

  ELSE

    IF Password<>$2 AND Password<>''(not set yet, change on next logon)'' THEN

      CoStatus := -2;

    ELSE

      IF Activated=0 THEN
        CoStatus := -3;
      END IF;

      IF age(DtCancel)<INTERVAL ''0 secs'' THEN
        CoStatus := -8;
      END IF;

      IF age(DtExpire)<INTERVAL ''0 secs'' THEN
        CoStatus := -9;
      END IF;

    END IF;

  END IF;

  RETURN CoStatus;
END;
' LANGUAGE 'plpgsql';
GO;

CREATE SEQUENCE seq_k_webbeacons INCREMENT 1 START 1
GO;

Open in new window

The problem is, it wont run :-) I tried several things but its getting worse and worse  
Can some one help me correct this
Thanks for helping out
th*
LVL 1
thomasbau65Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gerwin Jansen, EE MVETopic Advisor Commented:
Hi, what is the error message you get when you try to run the code above?
0
thomasbau65Author Commented:
ERROR:  syntax error at or near "GO"
LINE 44: GO;
         ^
Removing the GO

ERROR: language "plpgsql" does not exist
SQL state: 42704
Hint: Use CREATE LANGUAGE to load the language into the database.

if I change plpgsql to SQL

ERROR:  syntax error at or near "VARCHAR"
LINE 4:     Password  VARCHAR;
                      ^
0
earth man2Commented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PostgreSQL

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.