Ok, I've found the solution. I have only to surround MESSAGE
value with parenthesis :
So :
IF i>0 THEN
RAISE SQLSTATE '23505' USING MESSAGE = 'la planète est déjà occupée (planet_non_free)=(%, %, %)', NEW.galaxie, NEW.systeme_solaire, NEW.position;
END IF;
becomes :
IF i>0 THEN
RAISE SQLSTATE '23505' USING MESSAGE = ('la planète est déjà occupée (planet_non_free)=(%, %, %)', NEW.galaxie, NEW.systeme_solaire, NEW.position);
END IF;
Simple but I did not saw explicit example with dynamic MESSAGE
on the web.
Hope this helps
EDIT :
Ok sorry, the right syntax is this one :
IF i>0 THEN
RAISE SQLSTATE '23505' USING MESSAGE = 'la planète est déjà occupée (planet_non_free)=(' || NEW.galaxie || ',' || NEW.systeme_solaire || ',' || NEW.position || ')';
END IF;
It seems that we can not use %
with USING MESSAGE
statement.
MESSAGE = ('la planète..., NEW.position);
SET lc_messages='C';
to switch to English for the current session.