Hi,
On 11/24/23 3:05 PM, Yurii Rashkovskii wrote:
Hi,
I propose a patch that ensures `pg_convert` doesn't allocate and copy data when
no conversion is done. It is an unnecessary overhead, especially when such
conversions are done frequently and for large values.
+1 for the patch, I think the less is done the better.
Happy to hear any feedback!
The patch is pretty straightforward, I just have one remark:
+ /* if no actual conversion happened, return the original string */
+ /* (we are checking pointers to strings instead of encodings because
+ `pg_do_encoding_conversion` above covers more cases than just
+ encoding equality) */
I think this could be done in one single comment and follow the preferred style
for multi-line comment, see [1].
[1]: https://www.postgresql.org/docs/current/source-format.html
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com