Re: Deparsing rewritten query

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: Deparsing rewritten query
Дата
Msg-id 20210627133535.hsuf6jwmacmktpnj@nol
обсуждение исходный текст
Ответ на Re: Deparsing rewritten query  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers
On Sun, Jun 27, 2021 at 10:06:00AM -0300, Ranier Vilela wrote:
> 
> 1. strcmp(sql, "") could not be replaced by sql[0] == '\0'?

It's a debugging leftover that I forgot to remove.  There's no point trying
to catch an empty string as e.g. a single space would be exactly the same, and
both would be caught by the next (and correct) test.

> 3. initStringInfo(&buf) inside a loop, wouldn't it be exaggerated? each
> time call palloc0.

initStringInfo calls palloc, not palloc0.

It's unlikely to make any difference.  Rules have been strongly discouraged for
many years, and if you have enough to make a noticeable difference here, you
probably have bigger problems.  But no objection to reset the StringInfo
instead.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Re: Deparsing rewritten query
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Deparsing rewritten query