Re: plpgsql - can't get a simple block to execute - Mailing list pgsql-novice

From Tom Lane
Subject Re: plpgsql - can't get a simple block to execute
Date
Msg-id 26649.1112728840@sss.pgh.pa.us
Whole thread Raw
In response to plpgsql - can't get a simple block to execute  ("Walker, Jed S" <Jed_Walker@cable.comcast.com>)
List pgsql-novice
"Walker, Jed S" <Jed_Walker@cable.comcast.com> writes:
>> This should be simple, but it's not. I think I'm just missing something
>> simple.  I converted an oracle PL/SQL program to plpgssql, but it wouldn't
>> work, so I tried some very simple blocks, and even they fail. As far as I
>> can tell, the syntax is all valid.

You can't just type plpgsql statements at the SQL interpreter ... it's a
different language.  You have to wrap those statements within a function
definition.  (This is unlike Oracle, I believe, which does think it's
all one language.  PG keeps a strong separation because it supports more
than one function programming language.)

Also, don't forget you have to install plpgsql support into each
database you want to use it in; it's not enabled by default, due to
probably-overly-paranoid security concerns.  See the "createlang" shell
script for the easy way to do this.

            regards, tom lane

pgsql-novice by date:

Previous
From: "Celia McInnis"
Date:
Subject: casting for bit strings in plpgsql.
Next
From: Michael Fuhr
Date:
Subject: Re: plpgsql - can't get a simple block to execute