
Remove the code in plpgsql that suppressed the innermost line of CONTEXT for messages emitted by RAISE commands. That was never more than a quick backwards-compatibility hack, and it's pretty silly in cases where the RAISE is nested in several levels of function. What's more, it violated our design theory that verbosity of error reports should be controlled on the client side not the server side. To alleviate the resulting noise increase, introduce a feature in libpq and psql whereby the CONTEXT field of messages can be suppressed, either always or only for non-error messages. Printing CONTEXT for errors only is now their default behavior. The actual code changes here are pretty small, but the effects on the regression test outputs are widespread. I had to edit some of the alternative expected outputs by hand; hopefully the buildfarm will soon find anything I fat-fingered. In passing, fix up (again) the output line counts in psql's various help displays. Add some commentary about how to verify them. Pavel Stehule, reviewed by Petr Jelínek, Jeevan Chalke, and others
44 lines
902 B
Plaintext
44 lines
902 B
Plaintext
CREATE EXTENSION plpython2u;
|
|
CREATE EXTENSION ltree_plpython2u;
|
|
CREATE FUNCTION test1(val ltree) RETURNS int
|
|
LANGUAGE plpythonu
|
|
TRANSFORM FOR TYPE ltree
|
|
AS $$
|
|
plpy.info(repr(val))
|
|
return len(val)
|
|
$$;
|
|
SELECT test1('aa.bb.cc'::ltree);
|
|
INFO: ['aa', 'bb', 'cc']
|
|
test1
|
|
-------
|
|
3
|
|
(1 row)
|
|
|
|
CREATE FUNCTION test1n(val ltree) RETURNS int
|
|
LANGUAGE plpython2u
|
|
TRANSFORM FOR TYPE ltree
|
|
AS $$
|
|
plpy.info(repr(val))
|
|
return len(val)
|
|
$$;
|
|
SELECT test1n('aa.bb.cc'::ltree);
|
|
INFO: ['aa', 'bb', 'cc']
|
|
test1n
|
|
--------
|
|
3
|
|
(1 row)
|
|
|
|
CREATE FUNCTION test2() RETURNS ltree
|
|
LANGUAGE plpythonu
|
|
TRANSFORM FOR TYPE ltree
|
|
AS $$
|
|
return ['foo', 'bar', 'baz']
|
|
$$;
|
|
-- plpython to ltree is not yet implemented, so this will fail,
|
|
-- because it will try to parse the Python list as an ltree input
|
|
-- string.
|
|
SELECT test2();
|
|
ERROR: syntax error at position 0
|
|
CONTEXT: while creating return value
|
|
PL/Python function "test2"
|