doing %-expansion in plpgsql RAISE USING - Mailing list pgsql-hackers

From Alvaro Herrera
Subject doing %-expansion in plpgsql RAISE USING
Date
Msg-id 20090804132708.GA6494@alvh.no-ip.org
Whole thread Raw
Responses Re: doing %-expansion in plpgsql RAISE USING  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: doing %-expansion in plpgsql RAISE USING  (Pavel Stehule <pavel.stehule@gmail.com>)
List 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.


pgsql-hackers by date:

Previous
From: Tsutomu Yamada
Date:
Subject: Re: Proposal: More portable way to support 64bit platforms
Next
From: Tom Lane
Date:
Subject: Re: SE-PostgreSQL Specifications