Skip to content
Snippets Groups Projects
  • Heikki Linnakangas's avatar
    77328801
    Fix mapping of PostgreSQL encodings to Python encodings. · 77328801
    Heikki Linnakangas authored
    Windows encodings, "win1252" and so forth, are named differently in Python,
    like "cp1252". Also, if the PyUnicode_AsEncodedString() function call fails
    for some reason, use a plain ereport(), not a PLy_elog(), to report that
    error. That avoids recursion and crash, if PLy_elog() tries to call
    PLyUnicode_Bytes() again.
    
    This fixes bug reported by Asif Naeem. Backpatch down to 9.0, before that
    plpython didn't even try these conversions.
    
    Jan Urbański, with minor comment improvements by me.
    77328801
    History
    Fix mapping of PostgreSQL encodings to Python encodings.
    Heikki Linnakangas authored
    Windows encodings, "win1252" and so forth, are named differently in Python,
    like "cp1252". Also, if the PyUnicode_AsEncodedString() function call fails
    for some reason, use a plain ereport(), not a PLy_elog(), to report that
    error. That avoids recursion and crash, if PLy_elog() tries to call
    PLyUnicode_Bytes() again.
    
    This fixes bug reported by Asif Naeem. Backpatch down to 9.0, before that
    plpython didn't even try these conversions.
    
    Jan Urbański, with minor comment improvements by me.
plpy_util.c 3.73 KiB