Thread: PLPGSQL Installation

PLPGSQL Installation

From
Honza Rudovsky
Date:
Hi,

I have some problems running the procedural extension PLPGSQL.

I install PLPGSQL into my database using the "createlang" command and
everything seems to be OK, when I check it using "createlang -l".

Then I create a simple function, cut'n'pasted from the manual, and insert
it into the database. This also seems to be working quite fine.

But when I try to run this (or any other) PLPGSQL function, i get this
error message: "plpgsql: ERROR during compile of xxx near line 1".

Is there anything else I need to do (apart from running "createlang") in
order to use PLPGSQL or am I doing something wrong here?

Any kind of help is highly appreciated.

Thanks very much,
Jan Rudovsky

Re: PLPGSQL Installation

From
Tom Lane
Date:
Honza Rudovsky <XRUDOVSK@cs.felk.cvut.cz> writes:
> But when I try to run this (or any other) PLPGSQL function, i get this
> error message: "plpgsql: ERROR during compile of xxx near line 1".

Surely that's not the *only* message that comes out.  There should be
some mention of what the syntax error is exactly.

FWIW, if you are putting in known-good examples, the only gotcha I'm
aware of is that until recently the plpgsql parser wouldn't accept
carriage return (\r) characters as whitespace.  Depending on what
platform you're on and what tools you're using, perhaps newlines
are being pasted in as \r or \r\n instead of \n.  If the error
message has peculiar-looking formatting then suspect this even more.

            regards, tom lane

Re: PLPGSQL Installation

From
"Josh Berkus"
Date:
Jan,

You need to do this as well:

CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS
    '/usr/local/pgsql/lib/plpgsql.so' LANGUAGE 'C';

See
http://www.postgresql.org/idocs/index.php?xplang.html#XPLANG-INSTALL
For more details.

-Josh


______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco