Hi Peifeng, thank you for the bug report and the patch.

I can confirm your analysis and patch are correct and will fix this today in the trunk and the branches.

-- Christoph


Am 22.01.2018 um 05:10 schrieb Peifeng Qiu:
> Hi, developers.
>
> db.query for insert query should return the success insert count as
> string, but sometimes it returns unprintable string.
>
> For trunk, the implementation is connQuery().
> At line 2339, PQcmdTuples() will get the count string as "ret".
> But this string is internal buffer of "result". After PQclear() memory
> of "result" is freed and "ret" should be unavailable.
> Usually the memory is still accessible and remains untouched. This is
> why most time we get a correct answer. If memory manager decide to
> modify content for booking purpose we will get unprintable string. We
> have to make a copy of the string before it's cleared.
>
> I've attached a fix for trunk, this problem also exist in 4.x and 5.0.x.
>
> Best regards,
> Peifeng Qiu
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to