Re: pg/plsql question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fred Blaise <fred(dot)blaise(at)excilan(dot)com>
Cc: John DeSoi <desoi(at)pgedit(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: pg/plsql question
Date: 2005-03-15 15:34:52
Message-ID: 6452.1110900892@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fred Blaise <fred(dot)blaise(at)excilan(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ragnar Hafstað 2005-03-15 15:41:37 Re: plpython function problem workaround
Previous Message John DeSoi 2005-03-15 15:24:16 Re: pg/plsql question