Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf8c8386

Browse files
committed
Cleanup pass over PL/Python NLS. Add translation support to PLy_elog and
PLy_exception_set, and clarify some error messages.
1 parentd0fe3df commitf8c8386

File tree

5 files changed

+106
-99
lines changed

5 files changed

+106
-99
lines changed

‎src/pl/plpython/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.31 2008/10/02 08:11:11 petere Exp $
1+
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.32 2009/01/15 13:49:56 petere Exp $
22

33
subdir = src/pl/plpython
44
top_builddir = ../../..
@@ -54,7 +54,7 @@ python${pytverstr}.def: $(WD)/system32/python${pytverstr}.dll
5454
endif
5555

5656

57-
SHLIB_LINK =$(python_libspec)$(python_additional_libs)
57+
SHLIB_LINK =$(python_libspec)$(python_additional_libs)$(filter -lintl,$(LIBS))
5858

5959
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plpythonu
6060
REGRESS = plpython_schema plpython_populate plpython_function plpython_test plpython_error plpython_drop

‎src/pl/plpython/expected/plpython_error.out

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
-- the trigger handler once. the errors and subsequent core dump were
33
-- interesting.
44
SELECT invalid_type_uncaught('rick');
5-
WARNING:plpython: in function invalid_type_uncaught:
6-
DETAIL: plpy.SPIError: Unknown error in PLy_spi_prepare
5+
WARNING:PL/Python: inPL/Pythonfunction"invalid_type_uncaught"
6+
DETAIL:<class 'plpy.SPIError'>: unrecognized error in PLy_spi_prepare
77
ERROR: type "test" does not exist
88
SELECT invalid_type_caught('rick');
9-
WARNING:plpython: in function invalid_type_caught:
10-
DETAIL: plpy.SPIError: Unknown error in PLy_spi_prepare
9+
WARNING:PL/Python: inPL/Pythonfunction"invalid_type_caught"
10+
DETAIL:<class 'plpy.SPIError'>: unrecognized error in PLy_spi_prepare
1111
ERROR: type "test" does not exist
1212
SELECT invalid_type_reraised('rick');
13-
WARNING:plpython: in function invalid_type_reraised:
14-
DETAIL: plpy.SPIError: Unknown error in PLy_spi_prepare
13+
WARNING:PL/Python: inPL/Pythonfunction"invalid_type_reraised"
14+
DETAIL:<class 'plpy.SPIError'>: unrecognized error in PLy_spi_prepare
1515
ERROR: type "test" does not exist
1616
SELECT valid_type('rick');
1717
valid_type
@@ -23,16 +23,16 @@ SELECT valid_type('rick');
2323
-- Test Unicode error handling.
2424
--
2525
SELECT unicode_return_error();
26-
ERROR:plpython:function "unicode_return_error"could not create return value
27-
DETAIL: exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
26+
ERROR:PL/Python: could not create string representation of Python object in PL/Pythonfunction "unicode_return_error"while creating return value
27+
DETAIL:<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
2828
INSERT INTO unicode_test (testvalue) VALUES ('test');
29-
ERROR:plpython:function "unicode_trigger_error"could not modify tuple
30-
DETAIL: exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
29+
ERROR:PL/Python: could not compute string representation of Python object in PL/Pythonfunction "unicode_trigger_error"while modifying trigger row
30+
DETAIL:<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
3131
SELECT unicode_plan_error1();
32-
WARNING:plpython: in function unicode_plan_error1:
33-
DETAIL: plpy.Error: Unknown error in PLy_spi_execute_plan
34-
ERROR:plpython: function "unicode_plan_error1" could not execute plan
35-
DETAIL: exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
32+
WARNING:PL/Python: inPL/Pythonfunction"unicode_plan_error1"
33+
DETAIL:<class 'plpy.Error'>: unrecognized error in PLy_spi_execute_plan
34+
ERROR:PL/Python: PL/Python function "unicode_plan_error1" could not execute plan
35+
DETAIL:<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
3636
SELECT unicode_plan_error2();
37-
ERROR:plpython: function "unicode_plan_error2" could not execute plan
38-
DETAIL: exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)
37+
ERROR:PL/Python: PL/Python function "unicode_plan_error2" could not execute plan
38+
DETAIL:<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\x80' in position 0: ordinal not in range(128)

‎src/pl/plpython/expected/plpython_test.out

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ SELECT test_void_func1(), test_void_func1() IS NULL AS "is null";
190190
(1 row)
191191

192192
SELECT test_void_func2(); -- should fail
193-
ERROR: invalid return value from plpython function
194-
DETAIL: Functions returning type "void" must return None.
193+
ERROR: PL/Python function with return type "void" did not return None
195194
SELECT test_return_none(), test_return_none() IS NULL AS "is null";
196195
test_return_none | is null
197196
------------------+---------
@@ -547,7 +546,7 @@ SELECT * FROM test_in_out_params('test_in');
547546

548547
-- this doesn't work yet :-(
549548
SELECT * FROM test_in_out_params_multi('test_in');
550-
ERROR:plpython functions cannot return type record
549+
ERROR:PL/Python functions cannot return type record
551550
SELECT * FROM test_inout_params('test_in');
552551
first
553552
---------------

‎src/pl/plpython/nls.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# $PostgreSQL: pgsql/src/pl/plpython/nls.mk,v 1.1 2008/10/09 17:24:05 alvherre Exp $
1+
# $PostgreSQL: pgsql/src/pl/plpython/nls.mk,v 1.2 2009/01/15 13:49:56 petere Exp $
22
CATALOG_NAME:= plpython
33
AVAIL_LANGUAGES:=
44
GETTEXT_FILES:= plpython.c
5-
GETTEXT_TRIGGERS:=_errmsg errdetail errdetail_log errhint errcontextwrite_stderr yyerror
5+
GETTEXT_TRIGGERS:= errmsg errdetail errdetail_log errhint errcontextPLy_elog:2 PLy_exception_set:2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp