[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Postgres 8.4 Create Function

Posted on 2011-10-04
3
Medium Priority
?
822 Views
Last Modified: 2012-05-12
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*
0
Comment
Question by:thomasbau65
3 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 36912757
Hi, what is the error message you get when you try to run the code above?
0
 
LVL 1

Author Comment

by:thomasbau65
ID: 36912811
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
 
LVL 22

Accepted Solution

by:
earth man2 earned 2000 total points
ID: 36913175
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question