mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Drop support for Python 2.3
There is no specific reason for this right now, but keeping support for old Python versions around indefinitely increases the maintenance burden. The oldest supported Python version is now Python 2.4, which is still shipped in RHEL/CentOS 5 by default. In configure, add a check for the required Python version and give a friendly error message for an old version, instead of relying on an obscure build error later on.
This commit is contained in:
@ -94,26 +94,22 @@ kwargs = {
|
||||
"column_name": _column_name, "datatype_name": _datatype_name,
|
||||
"constraint_name": _constraint_name
|
||||
}
|
||||
# ignore None values - should work on Python2.3
|
||||
dict = {}
|
||||
for k in kwargs:
|
||||
if kwargs[k] is not None:
|
||||
dict[k] = kwargs[k]
|
||||
plpy.error(**dict)
|
||||
# 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 13, in <module>
|
||||
plpy.error(**dict)
|
||||
PL/Python function "raise_exception", line 9, 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 13, in <module>
|
||||
plpy.error(**dict)
|
||||
PL/Python function "raise_exception", line 9, 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',
|
||||
@ -128,8 +124,8 @@ ERROR: plpy.Error: message text
|
||||
DETAIL: detail text
|
||||
HINT: hint text
|
||||
CONTEXT: Traceback (most recent call last):
|
||||
PL/Python function "raise_exception", line 13, in <module>
|
||||
plpy.error(**dict)
|
||||
PL/Python function "raise_exception", line 9, 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',
|
||||
@ -139,8 +135,8 @@ SELECT raise_exception(_message => 'message text',
|
||||
ERROR: plpy.Error: message text
|
||||
HINT: hint text
|
||||
CONTEXT: Traceback (most recent call last):
|
||||
PL/Python function "raise_exception", line 13, in <module>
|
||||
plpy.error(**dict)
|
||||
PL/Python function "raise_exception", line 9, in <module>
|
||||
plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
|
||||
PL/Python function "raise_exception"
|
||||
DO $$
|
||||
DECLARE
|
||||
|
@ -521,15 +521,9 @@ PLy_input_datum_func2(PLyDatumToOb *arg, MemoryContext arg_mcxt, Oid typeOid, He
|
||||
static PyObject *
|
||||
PLyBool_FromBool(PLyDatumToOb *arg, Datum d)
|
||||
{
|
||||
/*
|
||||
* We would like to use Py_RETURN_TRUE and Py_RETURN_FALSE here for
|
||||
* generating SQL from trigger functions, but those are only supported in
|
||||
* Python >= 2.4, and we support older versions.
|
||||
* http://docs.python.org/api/boolObjects.html
|
||||
*/
|
||||
if (DatumGetBool(d))
|
||||
return PyBool_FromLong(1);
|
||||
return PyBool_FromLong(0);
|
||||
Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -55,12 +55,8 @@ kwargs = {
|
||||
"column_name": _column_name, "datatype_name": _datatype_name,
|
||||
"constraint_name": _constraint_name
|
||||
}
|
||||
# ignore None values - should work on Python2.3
|
||||
dict = {}
|
||||
for k in kwargs:
|
||||
if kwargs[k] is not None:
|
||||
dict[k] = kwargs[k]
|
||||
plpy.error(**dict)
|
||||
# ignore None values
|
||||
plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
SELECT raise_exception('hello', 'world');
|
||||
|
Reference in New Issue
Block a user