<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/postgresql.git/src/pl/plpython/expected/plpython_unicode_3.out, branch master</title>
<subtitle>git.postgresql.org: git/postgresql.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/'/>
<entry>
<title>Perform conversion from Python unicode to string/bytes object via UTF-8.</title>
<updated>2012-08-06T11:09:50+00:00</updated>
<author>
<name>Heikki Linnakangas</name>
<email>heikki.linnakangas@iki.fi</email>
</author>
<published>2012-08-06T10:02:15+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=3ff15883b1b4bcefb2278313a3137a688ebda505'/>
<id>3ff15883b1b4bcefb2278313a3137a688ebda505</id>
<content type='text'>
We used to convert the unicode object directly to a string in the server
encoding by calling Python's PyUnicode_AsEncodedString function. In other
words, we used Python's routines to do the encoding. However, that has a
few problems. First of all, it required keeping a mapping table of Python
encoding names and PostgreSQL encodings. But the real killer was that Python
doesn't support EUC_TW and MULE_INTERNAL encodings at all.

Instead, convert the Python unicode object to UTF-8, and use PostgreSQL's
encoding conversion functions to convert from UTF-8 to server encoding. We
were already doing the same in the other direction in PLyUnicode_FromString,
so this is more consistent, too.

Note: This makes SQL_ASCII to behave more leniently. We used to map
SQL_ASCII to Python's 'ascii', which on Python means strict 7-bit ASCII
only, so you got an error if the python string contained anything but pure
ASCII. You no longer get an error; you get the UTF-8 representation of the
string instead.

Backpatch to 9.0, where these conversions were introduced.

Jan Urbański
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We used to convert the unicode object directly to a string in the server
encoding by calling Python's PyUnicode_AsEncodedString function. In other
words, we used Python's routines to do the encoding. However, that has a
few problems. First of all, it required keeping a mapping table of Python
encoding names and PostgreSQL encodings. But the real killer was that Python
doesn't support EUC_TW and MULE_INTERNAL encodings at all.

Instead, convert the Python unicode object to UTF-8, and use PostgreSQL's
encoding conversion functions to convert from UTF-8 to server encoding. We
were already doing the same in the other direction in PLyUnicode_FromString,
so this is more consistent, too.

Note: This makes SQL_ASCII to behave more leniently. We used to map
SQL_ASCII to Python's 'ascii', which on Python means strict 7-bit ASCII
only, so you got an error if the python string contained anything but pure
ASCII. You no longer get an error; you get the UTF-8 representation of the
string instead.

Backpatch to 9.0, where these conversions were introduced.

Jan Urbański
</pre>
</div>
</content>
</entry>
<entry>
<title>Set client encoding explicitly in plpython_unicode test</title>
<updated>2011-04-16T18:53:43+00:00</updated>
<author>
<name>Peter Eisentraut</name>
<email>peter_e@gmx.net</email>
</author>
<published>2011-04-16T18:52:10+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=5809a6458450a59f8c4a7a25beaefc81cff563d1'/>
<id>5809a6458450a59f8c4a7a25beaefc81cff563d1</id>
<content type='text'>
This will (hopefully) eliminate the need for the
plpython_unicode_0.out expected file.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This will (hopefully) eliminate the need for the
plpython_unicode_0.out expected file.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update regression test files for PL/Python traceback patch</title>
<updated>2011-04-06T20:19:00+00:00</updated>
<author>
<name>Peter Eisentraut</name>
<email>peter_e@gmx.net</email>
</author>
<published>2011-04-06T20:19:00+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=5d0e462366f4521e37744fdb42fed3c6819a3374'/>
<id>5d0e462366f4521e37744fdb42fed3c6819a3374</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix regression tests after PL/Python custom SPI exceptions patch</title>
<updated>2011-02-28T17:43:36+00:00</updated>
<author>
<name>Peter Eisentraut</name>
<email>peter_e@gmx.net</email>
</author>
<published>2011-02-28T17:43:36+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=4b853c879d3c298b7ea7a09fcb74314bc54c37e4'/>
<id>4b853c879d3c298b7ea7a09fcb74314bc54c37e4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Clean up missed change to plpython expected files.</title>
<updated>2011-02-03T01:16:27+00:00</updated>
<author>
<name>Tom Lane</name>
<email>tgl@sss.pgh.pa.us</email>
</author>
<published>2011-02-03T01:16:27+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=907855ac759a221f95b502cd7cbf2ec851fe9523'/>
<id>907855ac759a221f95b502cd7cbf2ec851fe9523</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not prefix error messages with the string "PL/Python: "</title>
<updated>2011-01-26T23:00:58+00:00</updated>
<author>
<name>Peter Eisentraut</name>
<email>peter_e@gmx.net</email>
</author>
<published>2011-01-26T23:00:58+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=5829738868f8d87263b6d31675e08147d8d7c188'/>
<id>5829738868f8d87263b6d31675e08147d8d7c188</id>
<content type='text'>
It is redundant, given the error context.

Jan Urbański
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is redundant, given the error context.

Jan Urbański
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve exception usage in PL/Python</title>
<updated>2011-01-26T22:47:14+00:00</updated>
<author>
<name>Peter Eisentraut</name>
<email>peter_e@gmx.net</email>
</author>
<published>2011-01-26T22:47:14+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=582b5ac62e74a553e72151b321804a7b2e5fed6f'/>
<id>582b5ac62e74a553e72151b321804a7b2e5fed6f</id>
<content type='text'>
Use the built-in TypeError, not SPIError, for errors having to do with
argument counts or types.  Use SPIError, not simply plpy.Error, for
errors in PLy_spi_execute_plan.  Finally, do not set a Python
exception if PyArg_ParseTuple failed, as it already sets the correct
exception.

Jan Urbański
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use the built-in TypeError, not SPIError, for errors having to do with
argument counts or types.  Use SPIError, not simply plpy.Error, for
errors in PLy_spi_execute_plan.  Finally, do not set a Python
exception if PyArg_ParseTuple failed, as it already sets the correct
exception.

Jan Urbański
</pre>
</div>
</content>
</entry>
<entry>
<title>Also save the error detail in SPIError</title>
<updated>2011-01-26T22:35:28+00:00</updated>
<author>
<name>Peter Eisentraut</name>
<email>peter_e@gmx.net</email>
</author>
<published>2011-01-26T22:35:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=418df3a5dd94d9f02b895f9c161b2435d61e0729'/>
<id>418df3a5dd94d9f02b895f9c161b2435d61e0729</id>
<content type='text'>
The temporarily broken plpython_unicode test shows a case where this
is used.

Do remaining fix-ups on the expected files at the same time.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The temporarily broken plpython_unicode test shows a case where this
is used.

Do remaining fix-ups on the expected files at the same time.
</pre>
</div>
</content>
</entry>
<entry>
<title>Quick hack to un-break plpython regression tests.</title>
<updated>2011-01-23T01:43:54+00:00</updated>
<author>
<name>Tom Lane</name>
<email>tgl@sss.pgh.pa.us</email>
</author>
<published>2011-01-23T01:43:54+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=cc73c160507588bdc5822d7f2bb79d6b3a386761'/>
<id>cc73c160507588bdc5822d7f2bb79d6b3a386761</id>
<content type='text'>
It's not clear to me what should happen to the other plpython_unicode
variant expected files, but this patch gets things passing on my own
machines and at least some of the buildfarm.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's not clear to me what should happen to the other plpython_unicode
variant expected files, but this patch gets things passing on my own
machines and at least some of the buildfarm.
</pre>
</div>
</content>
</entry>
<entry>
<title>Improved printing of Python exceptions in PL/Python</title>
<updated>2010-01-16T11:03:51+00:00</updated>
<author>
<name>Peter Eisentraut</name>
<email>peter_e@gmx.net</email>
</author>
<published>2010-01-16T11:03:51+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/postgresql.git/commit/?id=44e03742d87ea518990ce9e20bee53c239456f20'/>
<id>44e03742d87ea518990ce9e20bee53c239456f20</id>
<content type='text'>
Mimic the Python interpreter's own logic for printing exceptions instead
of just using the straight str() call, so that
you get

    plpy.SPIError

instead of

    &lt;class 'plpy.SPIError'&gt;

and for built-in exceptions merely

    UnicodeEncodeError

Besides looking better this cuts down on the endless version differences
in the regression test expected files.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mimic the Python interpreter's own logic for printing exceptions instead
of just using the straight str() call, so that
you get

    plpy.SPIError

instead of

    &lt;class 'plpy.SPIError'&gt;

and for built-in exceptions merely

    UnicodeEncodeError

Besides looking better this cuts down on the endless version differences
in the regression test expected files.
</pre>
</div>
</content>
</entry>
</feed>
