Closed mfenniak closed 2 months ago
I've not tested this, but am happy to merge in a few days unless vetoed by @luss.
Question: let's say your efforts under #44 were merged. What would a new test based on the notes above look like? (This may be better answered in the PR for #44 to avoid blocking this PR).
I thnk it looks great and very much welcome shaheed doing the needful
On Sat, May 11, 2024 at 2:52 AM ShaheedHaque @.***> wrote:
I've not tested this, but am happy to merge in a few days unless vetoed by @luss https://github.com/luss.
Question: let's say your efforts under #44 https://github.com/pgsql-io/multicorn2/discussions/44 were merged. What would a new test based on the notes above look like?
— Reply to this email directly, view it on GitHub https://github.com/pgsql-io/multicorn2/pull/43#issuecomment-2105600672, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMWOHSOM63LWFCBDNQESH3ZBW52ZAVCNFSM6AAAAABHP2DMW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBVGYYDANRXGI . You are receiving this because you were mentioned.Message ID: @.***>
Question: let's say your efforts under #44 were merged. What would a new test based on the notes above look like? (This may be better answered in the PR for #44 to avoid blocking this PR).
In #46 I've had to code the test DB to run under "UTF8" in order to avoid this bug -- https://github.com/pgsql-io/multicorn2/blob/b50d02dd2a565708771e35d928dbd9676f187709/Makefile#L143. So a regression test to cover this case would either be removing that hack 🤣, or even better, running the test suites under a small collection of targeted/supported encodings.
I'll likely remove that in #46 after merging this.
Based upon the positive reviews and having addressed the C local comment, I'm going to make use of @luss's newly granted merge rights to go ahead with this. Thanks!
When a PostgreSQL database is running in SQL_ASCII encoding, anything in multicorn that touches PyString_AsString or PyString_AsStringAndSize will encounter an encoding error because "SQL_ASCII" isn't a valid Python encoding; and then the
errorCheck()
function will attempt to get the error that occurred, callreportException
, which callsPyString_AsString
, resulting in infinite recursion until the process segfaults.It seems that there's already a workaround in the form of the
getPythonEncodingName
name which translates SQL_ASCII to "ascii", used in some functions, but not in these ones; so I've applied those here.Reproduction steps:
initdb -E SQL_ASCII
Behavior before this patch: segfault; when debugged this codepath can be found (for the schema import scenario, if I remember correctly):
Behavior after: both an import and a delete works without segfault, at least.