Re: PLPGSQL - FUNCTION CREATION

From: "Andy Hallam" <ahm(at)exel(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PLPGSQL - FUNCTION CREATION
Date: 2001-09-28 09:42:40
Message-ID: 9p1goj$i81$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Please do not reply to this posting - I was too hasty in my post - I have
since found the answer:

$ createlang plpgsql <dbname>

Doh!

PS: Always search the archives thoroughly...Doh!

"Andy Hallam" <ahm(at)exel(dot)co(dot)uk> wrote in message
news:9p1egi$hsb$1(at)news(dot)tht(dot)net(dot)(dot)(dot)
> Hi all.
>
> I'm trying to write a function to update a TIMESTAMP column.
>
> MY TABLE SCHEMA:
>
> CREATE TABLE UserLog
> (
> User NCHAR(20) NOT NULL,
> ModifiedTimeStamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
> )
>
> What I want to do is that when a record is updated the ModifiedTimeStamp
> column is updated to the current time.
>
> Looking through the docs - great - create a function to do this - great -
> Ohh no!
>
> MY FUNCTION:
>
> CREATE FUNCTION NewTimeStamp () RETURNS OPAQUE AS '
> BEGIN
> NEW.ModifiedTimeStamp := ''now'';
> RETURN NEW;
> END;
> ' LANGUAGE 'plpgsql';
>
> When I execute the CREATE FUNCTION statement I get the following error:
>
> Error: Error while executing the query;
> ERROR: Unrecognized language specified in a CREATE FUNCTION: 'plpgsql'.
> Recognized languages are sql, C, internal, and created procedural
languages.
> (State:S1000, Native Code: 7)
>
>
> Help!
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shane Wright 2001-09-28 09:49:37 Re: backend stalls
Previous Message Janning Vygen 2001-09-28 09:22:16 converting to german date format