RAISE seems to be quite wonky.

The below function fails to compile due to the function call in the
arguement.

create function test(text) 
  returns bool 
  as '
begin
  raise exception ''test %'', quote_literal($1);
 
  return false;
end;
' language plpgsql;


Likewise, the below fails to compile due to error message being an
expression.  I know this one used to work not all that long ago. 
Digging through 7.0 docs even found an example of it.

create function test2(text) 
  returns bool 
  as '
begin
  raise exception ''test '' || ''more...'';
 
  return false;
end;
' language plpgsql;



Any thoughts on how to fix the first, and if the second could be
reverted?  It's a pain for long messages that they cannot be broken.

Yes, I could write an error handling routine which passes nice messages
to elog(), but I think thats a silly thing to do.




14 Jul 2002 20:37:32 -0400
Rod Taylor <rbt@zort.ca>
PLPGSQL and  Exceptions
Rod Taylor <rbt@zort.ca> writes:
> Likewise, the below fails to compile due to error message being an
> expression.  I know this one used to work not all that long ago. 
> Digging through 7.0 docs even found an example of it.

No, it never worked; that's why it was taken out of the docs.

The RAISE syntax is indeed annoyingly restrictive --- feel free to
improve it.

			regards, tom lane

Sun, 14 Jul 2002 21:07:51 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: PLPGSQL and Exceptions 