Re: pg/plsql question - Mailing list pgsql-general

From Tom Lane
Subject Re: pg/plsql question
Date
Msg-id 6452.1110900892@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg/plsql question  (Fred Blaise <fred.blaise@excilan.com>)
List pgsql-general
Fred Blaise <fred.blaise@excilan.com> writes:
> On Tue, 2005-03-15 at 09:58 -0500, John DeSoi wrote:
>> raise log ''t is %'', t;

> Yes, that's what I thought... but oddly nothing gets written.

Fred, your original example made it look like you were writing "
(one double quote mark) where what you need to write is ''
(two single quote marks).  The reason is that you are trying to
embed a single quote mark in the value of a string literal.
(If you are using PG 8.0 I'd suggest adopting the dollar-quoting
style for entering the function body, instead.)

Another problem I noticed is you were leaving off required
statement-ending semicolons, which could also prevent the plpgsql
parser from recognizing the RAISE command properly.

You might try something simpler just to get your feet wet:

    create function hello_world(text) returns text as '
    begin
        raise notice ''I got %'', $1;
        return $1;
    end' language plpgsql;

    select hello_world('Hi there!');

Once you get past that you'll have some idea about the quote marks
anyway ...

            regards, tom lane

pgsql-general by date:

Previous
From: John DeSoi
Date:
Subject: Re: pg/plsql question
Next
From: Ragnar Hafstað
Date:
Subject: Re: plpython function problem workaround