Commit 58297388 authored by Peter Eisentraut's avatar Peter Eisentraut

Do not prefix error messages with the string "PL/Python: "

It is redundant, given the error context.

Jan Urbański
parent 582b5ac6
...@@ -2,5 +2,5 @@ DO $$ plpy.notice("This is plpythonu.") $$ LANGUAGE plpythonu; ...@@ -2,5 +2,5 @@ DO $$ plpy.notice("This is plpythonu.") $$ LANGUAGE plpythonu;
NOTICE: This is plpythonu. NOTICE: This is plpythonu.
CONTEXT: PL/Python anonymous code block CONTEXT: PL/Python anonymous code block
DO $$ nonsense $$ LANGUAGE plpythonu; DO $$ nonsense $$ LANGUAGE plpythonu;
ERROR: PL/Python: NameError: global name 'nonsense' is not defined ERROR: NameError: global name 'nonsense' is not defined
CONTEXT: PL/Python anonymous code block CONTEXT: PL/Python anonymous code block
...@@ -8,9 +8,9 @@ CREATE FUNCTION sql_syntax_error() RETURNS text ...@@ -8,9 +8,9 @@ CREATE FUNCTION sql_syntax_error() RETURNS text
'plpy.execute("syntax error")' 'plpy.execute("syntax error")'
LANGUAGE plpythonu; LANGUAGE plpythonu;
SELECT sql_syntax_error(); SELECT sql_syntax_error();
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_execute_query WARNING: plpy.SPIError: unrecognized error in PLy_spi_execute_query
CONTEXT: PL/Python function "sql_syntax_error" CONTEXT: PL/Python function "sql_syntax_error"
ERROR: PL/Python: plpy.SPIError: syntax error at or near "syntax" ERROR: plpy.SPIError: syntax error at or near "syntax"
LINE 1: syntax error LINE 1: syntax error
^ ^
QUERY: syntax error QUERY: syntax error
...@@ -22,7 +22,7 @@ CREATE FUNCTION exception_index_invalid(text) RETURNS text ...@@ -22,7 +22,7 @@ CREATE FUNCTION exception_index_invalid(text) RETURNS text
'return args[1]' 'return args[1]'
LANGUAGE plpythonu; LANGUAGE plpythonu;
SELECT exception_index_invalid('test'); SELECT exception_index_invalid('test');
ERROR: PL/Python: IndexError: list index out of range ERROR: IndexError: list index out of range
CONTEXT: PL/Python function "exception_index_invalid" CONTEXT: PL/Python function "exception_index_invalid"
/* check handling of nested exceptions /* check handling of nested exceptions
*/ */
...@@ -32,9 +32,9 @@ CREATE FUNCTION exception_index_invalid_nested() RETURNS text ...@@ -32,9 +32,9 @@ CREATE FUNCTION exception_index_invalid_nested() RETURNS text
return rv[0]' return rv[0]'
LANGUAGE plpythonu; LANGUAGE plpythonu;
SELECT exception_index_invalid_nested(); SELECT exception_index_invalid_nested();
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_execute_query WARNING: plpy.SPIError: unrecognized error in PLy_spi_execute_query
CONTEXT: PL/Python function "exception_index_invalid_nested" CONTEXT: PL/Python function "exception_index_invalid_nested"
ERROR: PL/Python: plpy.SPIError: function test5(unknown) does not exist ERROR: plpy.SPIError: function test5(unknown) does not exist
LINE 1: SELECT test5('foo') LINE 1: SELECT test5('foo')
^ ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts. HINT: No function matches the given name and argument types. You might need to add explicit type casts.
...@@ -54,9 +54,9 @@ return None ...@@ -54,9 +54,9 @@ return None
' '
LANGUAGE plpythonu; LANGUAGE plpythonu;
SELECT invalid_type_uncaught('rick'); SELECT invalid_type_uncaught('rick');
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_prepare WARNING: plpy.SPIError: unrecognized error in PLy_spi_prepare
CONTEXT: PL/Python function "invalid_type_uncaught" CONTEXT: PL/Python function "invalid_type_uncaught"
ERROR: PL/Python: plpy.SPIError: type "test" does not exist ERROR: plpy.SPIError: type "test" does not exist
CONTEXT: PL/Python function "invalid_type_uncaught" CONTEXT: PL/Python function "invalid_type_uncaught"
/* for what it's worth catch the exception generated by /* for what it's worth catch the exception generated by
* the typo, and return None * the typo, and return None
...@@ -77,7 +77,7 @@ return None ...@@ -77,7 +77,7 @@ return None
' '
LANGUAGE plpythonu; LANGUAGE plpythonu;
SELECT invalid_type_caught('rick'); SELECT invalid_type_caught('rick');
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_prepare WARNING: plpy.SPIError: unrecognized error in PLy_spi_prepare
CONTEXT: PL/Python function "invalid_type_caught" CONTEXT: PL/Python function "invalid_type_caught"
NOTICE: type "test" does not exist NOTICE: type "test" does not exist
CONTEXT: PL/Python function "invalid_type_caught" CONTEXT: PL/Python function "invalid_type_caught"
...@@ -104,9 +104,9 @@ return None ...@@ -104,9 +104,9 @@ return None
' '
LANGUAGE plpythonu; LANGUAGE plpythonu;
SELECT invalid_type_reraised('rick'); SELECT invalid_type_reraised('rick');
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_prepare WARNING: plpy.SPIError: unrecognized error in PLy_spi_prepare
CONTEXT: PL/Python function "invalid_type_reraised" CONTEXT: PL/Python function "invalid_type_reraised"
ERROR: PL/Python: plpy.Error: type "test" does not exist ERROR: plpy.Error: type "test" does not exist
CONTEXT: PL/Python function "invalid_type_reraised" CONTEXT: PL/Python function "invalid_type_reraised"
/* no typo no messing about /* no typo no messing about
*/ */
......
...@@ -73,5 +73,5 @@ NOTICE: notice ...@@ -73,5 +73,5 @@ NOTICE: notice
CONTEXT: PL/Python function "elog_test" CONTEXT: PL/Python function "elog_test"
WARNING: warning WARNING: warning
CONTEXT: PL/Python function "elog_test" CONTEXT: PL/Python function "elog_test"
ERROR: PL/Python: plpy.Error: error ERROR: plpy.Error: error
CONTEXT: PL/Python function "elog_test" CONTEXT: PL/Python function "elog_test"
...@@ -596,7 +596,7 @@ CREATE FUNCTION test_type_conversion_array_error() RETURNS int[] AS $$ ...@@ -596,7 +596,7 @@ CREATE FUNCTION test_type_conversion_array_error() RETURNS int[] AS $$
return 5 return 5
$$ LANGUAGE plpythonu; $$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_array_error(); SELECT * FROM test_type_conversion_array_error();
ERROR: PL/Python: return value of function with array return type is not a Python sequence ERROR: return value of function with array return type is not a Python sequence
CONTEXT: while creating return value CONTEXT: while creating return value
PL/Python function "test_type_conversion_array_error" PL/Python function "test_type_conversion_array_error"
-- --
......
...@@ -596,7 +596,7 @@ CREATE FUNCTION test_type_conversion_array_error() RETURNS int[] AS $$ ...@@ -596,7 +596,7 @@ CREATE FUNCTION test_type_conversion_array_error() RETURNS int[] AS $$
return 5 return 5
$$ LANGUAGE plpython3u; $$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_array_error(); SELECT * FROM test_type_conversion_array_error();
ERROR: PL/Python: return value of function with array return type is not a Python sequence ERROR: return value of function with array return type is not a Python sequence
CONTEXT: while creating return value CONTEXT: while creating return value
PL/Python function "test_type_conversion_array_error" PL/Python function "test_type_conversion_array_error"
-- --
......
...@@ -24,12 +24,12 @@ rv = plpy.execute(plan, ["foo", "bar"], 1) ...@@ -24,12 +24,12 @@ rv = plpy.execute(plan, ["foo", "bar"], 1)
return rv[0]["testvalue"] return rv[0]["testvalue"]
' LANGUAGE plpythonu; ' LANGUAGE plpythonu;
SELECT unicode_return(); SELECT unicode_return();
ERROR: PL/Python: could not convert Python Unicode object to PostgreSQL server encoding ERROR: could not convert Python Unicode object to PostgreSQL server encoding
DETAIL: UnicodeError: ASCII encoding error: ordinal not in range(128) DETAIL: UnicodeError: ASCII encoding error: ordinal not in range(128)
CONTEXT: while creating return value CONTEXT: while creating return value
PL/Python function "unicode_return" PL/Python function "unicode_return"
INSERT INTO unicode_test (testvalue) VALUES ('test'); INSERT INTO unicode_test (testvalue) VALUES ('test');
ERROR: PL/Python: could not convert Python Unicode object to PostgreSQL server encoding ERROR: could not convert Python Unicode object to PostgreSQL server encoding
DETAIL: UnicodeError: ASCII encoding error: ordinal not in range(128) DETAIL: UnicodeError: ASCII encoding error: ordinal not in range(128)
CONTEXT: while modifying trigger row CONTEXT: while modifying trigger row
PL/Python function "unicode_trigger" PL/Python function "unicode_trigger"
...@@ -39,9 +39,9 @@ SELECT * FROM unicode_test; ...@@ -39,9 +39,9 @@ SELECT * FROM unicode_test;
(0 rows) (0 rows)
SELECT unicode_plan1(); SELECT unicode_plan1();
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_execute_plan WARNING: plpy.SPIError: unrecognized error in PLy_spi_execute_plan
CONTEXT: PL/Python function "unicode_plan1" CONTEXT: PL/Python function "unicode_plan1"
ERROR: PL/Python: plpy.SPIError: PL/Python: could not convert Python Unicode object to PostgreSQL server encoding ERROR: plpy.SPIError: could not convert Python Unicode object to PostgreSQL server encoding
DETAIL: UnicodeError: ASCII encoding error: ordinal not in range(128) DETAIL: UnicodeError: ASCII encoding error: ordinal not in range(128)
CONTEXT: PL/Python function "unicode_plan1" CONTEXT: PL/Python function "unicode_plan1"
SELECT unicode_plan2(); SELECT unicode_plan2();
......
...@@ -24,12 +24,12 @@ rv = plpy.execute(plan, ["foo", "bar"], 1) ...@@ -24,12 +24,12 @@ rv = plpy.execute(plan, ["foo", "bar"], 1)
return rv[0]["testvalue"] return rv[0]["testvalue"]
' LANGUAGE plpythonu; ' LANGUAGE plpythonu;
SELECT unicode_return(); SELECT unicode_return();
ERROR: PL/Python: could not convert Python Unicode object to PostgreSQL server encoding ERROR: could not convert Python Unicode object to PostgreSQL server encoding
DETAIL: UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128) DETAIL: UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
CONTEXT: while creating return value CONTEXT: while creating return value
PL/Python function "unicode_return" PL/Python function "unicode_return"
INSERT INTO unicode_test (testvalue) VALUES ('test'); INSERT INTO unicode_test (testvalue) VALUES ('test');
ERROR: PL/Python: could not convert Python Unicode object to PostgreSQL server encoding ERROR: could not convert Python Unicode object to PostgreSQL server encoding
DETAIL: UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128) DETAIL: UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
CONTEXT: while modifying trigger row CONTEXT: while modifying trigger row
PL/Python function "unicode_trigger" PL/Python function "unicode_trigger"
...@@ -39,9 +39,9 @@ SELECT * FROM unicode_test; ...@@ -39,9 +39,9 @@ SELECT * FROM unicode_test;
(0 rows) (0 rows)
SELECT unicode_plan1(); SELECT unicode_plan1();
WARNING: PL/Python: plpy.SPIError: unrecognized error in PLy_spi_execute_plan WARNING: plpy.SPIError: unrecognized error in PLy_spi_execute_plan
CONTEXT: PL/Python function "unicode_plan1" CONTEXT: PL/Python function "unicode_plan1"
ERROR: PL/Python: plpy.SPIError: PL/Python: could not convert Python Unicode object to PostgreSQL server encoding ERROR: plpy.SPIError: could not convert Python Unicode object to PostgreSQL server encoding
DETAIL: UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128) DETAIL: UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
CONTEXT: PL/Python function "unicode_plan1" CONTEXT: PL/Python function "unicode_plan1"
SELECT unicode_plan2(); SELECT unicode_plan2();
......
...@@ -3615,14 +3615,14 @@ PLy_elog(int elevel, const char *fmt,...) ...@@ -3615,14 +3615,14 @@ PLy_elog(int elevel, const char *fmt,...)
{ {
if (fmt) if (fmt)
ereport(elevel, ereport(elevel,
(errmsg("PL/Python: %s", emsg.data), (errmsg("%s", emsg.data),
(xmsg) ? errdetail("%s", xmsg) : 0, (xmsg) ? errdetail("%s", xmsg) : 0,
(hint) ? errhint("%s", hint) : 0, (hint) ? errhint("%s", hint) : 0,
(query) ? internalerrquery(query) : 0, (query) ? internalerrquery(query) : 0,
(position) ? internalerrposition(position) : 0)); (position) ? internalerrposition(position) : 0));
else else
ereport(elevel, ereport(elevel,
(errmsg("PL/Python: %s", xmsg), (errmsg("%s", xmsg),
(detail) ? errdetail("%s", detail) : 0, (detail) ? errdetail("%s", detail) : 0,
(hint) ? errhint("%s", hint) : 0, (hint) ? errhint("%s", hint) : 0,
(query) ? internalerrquery(query) : 0, (query) ? internalerrquery(query) : 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment