Re: possible repalloc() in icu_convert_case()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Anton Voloshin <a(dot)voloshin(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: possible repalloc() in icu_convert_case()
Date: 2021-04-04 16:20:38
Message-ID: 172640.1617553238@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Anton Voloshin <a(dot)voloshin(at)postgrespro(dot)ru> writes:
> in src/backend/utils/adt/formatting.c, in icu_convert_case() I see:
> if (status == U_BUFFER_OVERFLOW_ERROR)
> {
> /* try again with adjusted length */
> pfree(*buff_dest);
> *buff_dest = palloc(len_dest * sizeof(**buff_dest));
> ...

> Is there any reason why this should not be repalloc()?

repalloc is likely to be more expensive, since it implies copying
data which isn't helpful here. I think this code is fine as-is.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-04-04 16:43:19 Re: ModifyTable overheads in generic plans
Previous Message Zhihong Yu 2021-04-04 16:19:27 Re: Allow batched insert during cross-partition updates