Re: [PATCH] pg_convert improvement - Mailing list pgsql-hackers

From Drouvot, Bertrand
Subject Re: [PATCH] pg_convert improvement
Date
Msg-id b0bfe9d0-9bd6-4c83-9953-dbf5b0b26774@gmail.com
Whole thread Raw
In response to [PATCH] pg_convert improvement  (Yurii Rashkovskii <yrashk@gmail.com>)
Responses Re: [PATCH] pg_convert improvement
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Adding facility for injection points (or probe points?) for more advanced tests
Next
From: Yurii Rashkovskii
Date:
Subject: Re: [PATCH] pg_convert improvement