diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c index 35f15d9..8a74eec 100644 --- a/src/pl/plpython/plpy_main.c +++ b/src/pl/plpython/plpy_main.c @@ -155,8 +155,13 @@ PLy_init_interp(void) if (PLy_interp_globals == NULL || PyErr_Occurred()) PLy_elog(ERROR, "could not initialize globals"); - - decimal = PyImport_ImportModule("decimal"); + /* Try to import cdecimal, if it doesnt exist, fallback to decimal */ + decimal = PyImport_ImportModule("cdecimal"); + if (decimal == NULL) + { + PyErr_Clear(); + decimal = PyImport_ImportModule("decimal"); + } if (decimal == NULL) PLy_elog(ERROR, "could not import module 'decimal'");