Thread: Writing plpgsql not in a function (directly from plsql)?

Writing plpgsql not in a function (directly from plsql)?

From
Vitaly Belman
Date:
Is it possible to write plpgsq from psql? I don't want to write a
function just to write a little script, for example, I'd like to write
something like:

begin;
if 1 > 3 then
   raise notice 'Hi';
end if;
commit;

--
 ICQ: 1912453
 AIM: VitalyB1984
 MSN: tmdagent@hotmail.com
 Yahoo!: VitalyBe

Re: Writing plpgsql not in a function (directly from plsql)?

From
Vitaly Belman
Date:
The idea is to write it without creating a function... Just as a quick script.

Not possible? :(


On Sun, 3 Oct 2004 11:21:50 -0400, John DeSoi <jd@icx.net> wrote:
>
> On Oct 2, 2004, at 5:59 PM, Vitaly Belman wrote:
>
> > Is it possible to write plpgsq from psql? I don't want to write a
> > function just to write a little script, for example, I'd like to write
> > something like:
>
> You can do this from psql, but you need to use the CREATE FUNCTION
> command and enclose your procedure body in quotes.
>
> See
> http://www.postgresql.org/docs/current/interactive/sql-
> createfunction.html
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>



--
 ICQ: 1912453
 AIM: VitalyB1984
 MSN: tmdagent@hotmail.com
 Yahoo!: VitalyBe

Re: Writing plpgsql not in a function (directly from plsql)?

From
John DeSoi
Date:
On Oct 3, 2004, at 2:05 PM, Vitaly Belman wrote:

> The idea is to write it without creating a function... Just as a quick
> script.
>
> Not possible? :(

No, I don't think so. psql accepts \ commands and valid SQL commands.
Nothing else.

Best,

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL