Hi
2016-04-08 20:54 GMT+02:00 Pavel Stehule <[email protected]>:
>
>
> 2016-04-08 20:52 GMT+02:00 Tom Lane <[email protected]>:
>
>> Pavel Stehule <[email protected]> writes:
>> > 2016-04-08 17:38 GMT+02:00 Teodor Sigaev <[email protected]>:
>> >> thank you, pushed. Pls, pay attention to buildfarm.
>>
>> > Thank you very much for commit.
>>
>> According to buildfarm member prairiedog, there's a problem in one
>> of the test cases. I suspect that it's using syntax that doesn't
>> exist in Python 2.3, but don't know enough Python to fix it.
>>
>> Please submit a correction -- we are not moving the goalposts on
>> Python version compatibility for the convenience of one test case.
>>
>
> I'll fix it.
>
>
here is patch
I found related discussion -
http://postgresql.nabble.com/Minimum-supported-version-of-Python-td5796175.html
Regards
Pavel
> Regards
>
> Pavel
>
>>
>> regards, tom lane
>>
>
>
diff --git a/src/pl/plpython/expected/plpython_test.out b/src/pl/plpython/expected/plpython_test.out
new file mode 100644
index 05caba1..bc7707d
*** a/src/pl/plpython/expected/plpython_test.out
--- b/src/pl/plpython/expected/plpython_test.out
*************** RETURNS void AS $$
*** 150,171 ****
kwargs = { "message":_message, "detail":_detail, "hint":_hint,
"sqlstate":_sqlstate, "schema":_schema, "table":_table,
"column":_column, "datatype":_datatype, "constraint":_constraint }
! # ignore None values
! plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
$$ LANGUAGE plpythonu;
SELECT raise_exception('hello', 'world');
ERROR: plpy.Error: hello
DETAIL: world
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 6, in <module>
! plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
SELECT raise_exception('message text', 'detail text', _sqlstate => 'YY333');
ERROR: plpy.Error: message text
DETAIL: detail text
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 6, in <module>
! plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
SELECT raise_exception(_message => 'message text',
_detail => 'detail text',
--- 150,175 ----
kwargs = { "message":_message, "detail":_detail, "hint":_hint,
"sqlstate":_sqlstate, "schema":_schema, "table":_table,
"column":_column, "datatype":_datatype, "constraint":_constraint }
! # ignore None values - should to work on Python2.3
! dict = {}
! for k in kwargs:
! if kwargs[k] is not None:
! dict[k] = kwargs[k]
! plpy.error(**dict)
$$ LANGUAGE plpythonu;
SELECT raise_exception('hello', 'world');
ERROR: plpy.Error: hello
DETAIL: world
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 10, in <module>
! plpy.error(**dict)
PL/Python function "raise_exception"
SELECT raise_exception('message text', 'detail text', _sqlstate => 'YY333');
ERROR: plpy.Error: message text
DETAIL: detail text
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 10, in <module>
! plpy.error(**dict)
PL/Python function "raise_exception"
SELECT raise_exception(_message => 'message text',
_detail => 'detail text',
*************** ERROR: plpy.Error: message text
*** 180,187 ****
DETAIL: detail text
HINT: hint text
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 6, in <module>
! plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
SELECT raise_exception(_message => 'message text',
_hint => 'hint text',
--- 184,191 ----
DETAIL: detail text
HINT: hint text
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 10, in <module>
! plpy.error(**dict)
PL/Python function "raise_exception"
SELECT raise_exception(_message => 'message text',
_hint => 'hint text',
*************** SELECT raise_exception(_message => 'mess
*** 191,198 ****
ERROR: plpy.Error: message text
HINT: hint text
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 6, in <module>
! plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
DO $$
DECLARE
--- 195,202 ----
ERROR: plpy.Error: message text
HINT: hint text
CONTEXT: Traceback (most recent call last):
! PL/Python function "raise_exception", line 10, in <module>
! plpy.error(**dict)
PL/Python function "raise_exception"
DO $$
DECLARE
diff --git a/src/pl/plpython/sql/plpython_test.sql b/src/pl/plpython/sql/plpython_test.sql
new file mode 100644
index 6e5b535..294f2dd
*** a/src/pl/plpython/sql/plpython_test.sql
--- b/src/pl/plpython/sql/plpython_test.sql
*************** RETURNS void AS $$
*** 102,109 ****
kwargs = { "message":_message, "detail":_detail, "hint":_hint,
"sqlstate":_sqlstate, "schema":_schema, "table":_table,
"column":_column, "datatype":_datatype, "constraint":_constraint }
! # ignore None values
! plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
$$ LANGUAGE plpythonu;
SELECT raise_exception('hello', 'world');
--- 102,113 ----
kwargs = { "message":_message, "detail":_detail, "hint":_hint,
"sqlstate":_sqlstate, "schema":_schema, "table":_table,
"column":_column, "datatype":_datatype, "constraint":_constraint }
! # ignore None values - should to work on Python2.3
! dict = {}
! for k in kwargs:
! if kwargs[k] is not None:
! dict[k] = kwargs[k]
! plpy.error(**dict)
$$ LANGUAGE plpythonu;
SELECT raise_exception('hello', 'world');
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers