By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,809 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,809 IT Pros & Developers. It's quick & easy.

Create Function... ERROR: language "plpgsql" does not exist

P: n/a
I copied an example from the help:

CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30
quantity := 50;
--
-- Create a subblock
--
DECLARE
quantity integer := 80;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is
80
END;

RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 50

RETURN quantity;
END;
' LANGUAGE plpgsql
Ran it is a SQL window from pgAdmin and got this error:

ERROR: language "plpgsql" does not exist

Thanks,
Thomas LeBlanc

__________________________________________________ _______________
Share your photos without swamping your Inbox. Get Hotmail Extra Storage
today! http://join.msn.com/?PAGE=features/es
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
You do not have the language installed in the database.

use the createlang function in the bin directory and create the langiage
for the data base i.e.

createlang -d dbname plpgsql

HTH
Darren

On Mon, 13 Oct 2003, Thomas LeBlanc wrote:
I copied an example from the help:

CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30
quantity := 50;
--
-- Create a subblock
--
DECLARE
quantity integer := 80;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is
80
END;

RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 50

RETURN quantity;
END;
' LANGUAGE plpgsql
Ran it is a SQL window from pgAdmin and got this error:

ERROR: language "plpgsql" does not exist

Thanks,
Thomas LeBlanc

__________________________________________________ _______________
Share your photos without swamping your Inbox. Get Hotmail Extra Storage
today! http://join.msn.com/?PAGE=features/es
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org


--
Darren Ferguson
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #2

P: n/a
Hi Thomas,

Did you create/insert plpgsql language in your database? I guess not...

Check your database with createlang -l YOUR_DATABASE_NAME. This should
show you the languages installed in your database. In case you don't
have it, just use createlang plplgsql YOUR_DATABASE_NAME. This should
work...
Suggestion, if you are gonna use plpgsql a lot developing in
Postgresql, I suggest that you create the language you need in template1
(createlang LANGUAGE template1). By doing that you will automatically
create the language in your new database when issuing a createdb
NEWDATABASE, because createdb uses template1 as a template to create
your new database...

RTM createlang for more info...

On Mon, 13 Oct 2003 10:58:55 -0500
"Thomas LeBlanc" <th*********@hotmail.com> wrote:
I copied an example from the help:

CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here
is 30 quantity := 50;
--
-- Create a subblock
--
DECLARE
quantity integer := 80;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity
here is
80
END;

RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here
is 50

RETURN quantity;
END;
' LANGUAGE plpgsql
Ran it is a SQL window from pgAdmin and got this error:

ERROR: language "plpgsql" does not exist

Thanks,
Thomas LeBlanc

__________________________________________________ _______________
Share your photos without swamping your Inbox. Get Hotmail Extra
Storage today! http://join.msn.com/?PAGE=features/es
---------------------------(end of
broadcast)--------------------------- TIP 1: subscribe and unsubscribe
commands go to ma*******@postgresql.org

-----------------------------

Cordialmente,

RenÍ Salom„o
re**@ibiz.com.br
re**********@interchange.com.br

--------------------------------

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #3

P: n/a
Hi Thomas,

Did you create/insert plpgsql language in your database? I guess not...

Check your database with createlang -l YOUR_DATABASE_NAME. This should
show you the languages installed in your database. In case you don't
have it, just use createlang plplgsql YOUR_DATABASE_NAME. This should
work...
Suggestion, if you are gonna use plpgsql a lot developing in
Postgresql, I suggest that you create the language you need in template1
(createlang LANGUAGE template1). By doing that you will automatically
create the language in your new database when issuing a createdb
NEWDATABASE, because createdb uses template1 as a template to create
your new database...

RTM createlang for more info...

On Mon, 13 Oct 2003 10:58:55 -0500
"Thomas LeBlanc" <th*********@hotmail.com> wrote:
I copied an example from the help:

CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here
is 30 quantity := 50;
--
-- Create a subblock
--
DECLARE
quantity integer := 80;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity
here is
80
END;

RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here
is 50

RETURN quantity;
END;
' LANGUAGE plpgsql
Ran it is a SQL window from pgAdmin and got this error:

ERROR: language "plpgsql" does not exist

Thanks,
Thomas LeBlanc

__________________________________________________ _______________
Share your photos without swamping your Inbox. Get Hotmail Extra
Storage today! http://join.msn.com/?PAGE=features/es
---------------------------(end of
broadcast)--------------------------- TIP 1: subscribe and unsubscribe
commands go to ma*******@postgresql.org

-----------------------------

Cordialmente,

RenÍ Salom„o
re**@ibiz.com.br
re**********@interchange.com.br

--------------------------------

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #4

P: n/a
You need to create the plpgsql language in your database first. See
http://www.faqs.org/docs/ppbook/c19610.htm for how to do this.

Hope this helps,
ch**@crashed.net

th*********@hotmail.com ("Thomas LeBlanc") wrote in message news:<La*************************@hotmail.com>...
I copied an example from the help:

CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30
quantity := 50;
--
-- Create a subblock
--
DECLARE
quantity integer := 80;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is
80
END;

RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 50

RETURN quantity;
END;
' LANGUAGE plpgsql
Ran it is a SQL window from pgAdmin and got this error:

ERROR: language "plpgsql" does not exist

Thanks,
Thomas LeBlanc

Nov 12 '05 #5

P: n/a
You need to create the plpgsql language in your database first. See
http://www.faqs.org/docs/ppbook/c19610.htm for how to do this.

Hope this helps,
ch**@crashed.net

th*********@hotmail.com ("Thomas LeBlanc") wrote in message news:<La*************************@hotmail.com>...
I copied an example from the help:

CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30
quantity := 50;
--
-- Create a subblock
--
DECLARE
quantity integer := 80;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is
80
END;

RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 50

RETURN quantity;
END;
' LANGUAGE plpgsql
Ran it is a SQL window from pgAdmin and got this error:

ERROR: language "plpgsql" does not exist

Thanks,
Thomas LeBlanc

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.