Re: Deparsing rewritten query

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: Deparsing rewritten query
Date: 2021-06-27 13:35:35
Message-ID: 20210627133535.hsuf6jwmacmktpnj@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-06-27 14:34:52 Re: Deparsing rewritten query
Previous Message Ranier Vilela 2021-06-27 13:06:00 Re: Deparsing rewritten query