doing %-expansion in plpgsql RAISE USING

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: doing %-expansion in plpgsql RAISE USING
Date: 2009-08-04 13:27:08
Message-ID: 20090804132708.GA6494@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

It seems there's no way to do %-expansion in plpgsql when one is using
RAISE USING:

alvherre=# create or replace function f () returns void language plpgsql as $$
begin
raise using message = 'hello %' || 'world';
return;
end;
$$;
CREATE FUNCTION
alvherre=# select f();
ERROR: hello %world

I would like the % to be expanded to some argument, but obviously
there's no way to pass the arguments that it should expand to. We could
do something like

RAISE USING message = 'hello %st %', args = 1, 'world'

but this is obviously going to be difficult, if not impossible, to
implement in the grammar. Perhaps
RAISE USING message = 'brave %st %', args = (1, 'world')

Thoughts?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-04 13:41:13 Re: SE-PostgreSQL Specifications
Previous Message wader2 2009-08-04 13:26:35 Re: BUG #4961: pg_standby.exe crashes with no args