Hello 2009/8/4 Alvaro Herrera <alvhe...@commandprompt.com>: > 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 > >
parameter is expression, so we could to define operator % like text % any % isn't defined for text so this is possible. This operator should be generally used, not only in RAISE attribs. > 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' > RAISE USING message = 'hello %st %' % (1, 'world') ?? or simple use custom variadic function RAISE USING message= subst('hello %st %', 1, 'world') good example for parser hook :) Pavel > 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. > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers