Обсуждение: Problems w/ PL/pgSQL not being loaded?

Поиск
Список
Период
Сортировка

Problems w/ PL/pgSQL not being loaded?

От
"Diehl, Jeffrey"
Дата:
Hi all.

Once again, I'm trying to climb the learning curve...

I'm trying to write a trigger in PL/pgSQL to update some tables.  When I try
to load the function, I get an error message:

The function is:

create function update_modified () returns opauqe as '       BEGIN               NEW.modified := ''now()'';
 return 1;       END;
 
'
language 'plpgsql';

The error message indicates that I'm trying to us an unrecognized language.
The recognized languages are sql, C, internal and other created languages.
I've not loaded anything besides the default.

1.  How do I load PL/pgSQL?

2.  Does this function look right?  It should change the a.modified field
upon update.

Thanx again,
Mike Diehl,
Network Monitoring Tool Devl.
284-3137
jdiehl@sandia.gov



Re: Problems w/ PL/pgSQL not being loaded?

От
Philip Hallstrom
Дата:
I just did this in 7.1 (and I think it's pretty similar in 7.0.x).

cd into the src/pl/plpgsql directory and type "gmake && gmake install"

Then as the postgres super user type "createlang plpgsql dbname"

where "dbname" is the name of the database you want to add it to.

If you add it to template1 then all new databases will automatically get
it.

good luck!

-philip

On Tue, 17 Apr 2001, Diehl, Jeffrey wrote:

> Hi all.
>
> Once again, I'm trying to climb the learning curve...
>
> I'm trying to write a trigger in PL/pgSQL to update some tables.  When I try
> to load the function, I get an error message:
>
> The function is:
>
> create function update_modified () returns opauqe as '
>         BEGIN
>                 NEW.modified := ''now()'';
>                 return 1;
>         END;
> '
> language 'plpgsql';
>
> The error message indicates that I'm trying to us an unrecognized language.
> The recognized languages are sql, C, internal and other created languages.
> I've not loaded anything besides the default.
>
> 1.  How do I load PL/pgSQL?
>
> 2.  Does this function look right?  It should change the a.modified field
> upon update.
>
> Thanx again,
> Mike Diehl,
> Network Monitoring Tool Devl.
> 284-3137
> jdiehl@sandia.gov
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



RE: Problems w/ PL/pgSQL not being loaded?

От
"Diehl, Jeffrey"
Дата:
Yup.

Took me all of 15 minutes to do this and test it.  

Thanx much,
Mike Diehl,
Network Monitoring Tool Devl.
284-3137
jdiehl@sandia.gov


> -----Original Message-----
> From: Philip Hallstrom [mailto:philip@adhesivemedia.com]
> Sent: April 17, 2001 5:02 PM
> To: Diehl, Jeffrey
> Cc: pgsql-sql@postgresql.org
> Subject: Re: Problems w/ PL/pgSQL not being loaded?
> 
> 
> I just did this in 7.1 (and I think it's pretty similar in 7.0.x).
> 
> cd into the src/pl/plpgsql directory and type "gmake && gmake install"
> 
> Then as the postgres super user type "createlang plpgsql dbname"
> 
> where "dbname" is the name of the database you want to add it to.
> 
> If you add it to template1 then all new databases will 
> automatically get
> it.
> 
> good luck!
> 
> -philip
> 
> On Tue, 17 Apr 2001, Diehl, Jeffrey wrote:
> 
> > Hi all.
> >
> > Once again, I'm trying to climb the learning curve...
> >
> > I'm trying to write a trigger in PL/pgSQL to update some 
> tables.  When I try
> > to load the function, I get an error message:
> >
> > The function is:
> >
> > create function update_modified () returns opauqe as '
> >         BEGIN
> >                 NEW.modified := ''now()'';
> >                 return 1;
> >         END;
> > '
> > language 'plpgsql';
> >
> > The error message indicates that I'm trying to us an 
> unrecognized language.
> > The recognized languages are sql, C, internal and other 
> created languages.
> > I've not loaded anything besides the default.
> >
> > 1.  How do I load PL/pgSQL?
> >
> > 2.  Does this function look right?  It should change the 
> a.modified field
> > upon update.
> >
> > Thanx again,
> > Mike Diehl,
> > Network Monitoring Tool Devl.
> > 284-3137
> > jdiehl@sandia.gov
> >
> >
> > ---------------------------(end of 
> broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to 
> majordomo@postgresql.org)
> >
> 
>