Re: Deparsing rewritten query - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: Deparsing rewritten query
Date
Msg-id 20210627133535.hsuf6jwmacmktpnj@nol
Whole thread Raw
In response to Re: Deparsing rewritten query  (Ranier Vilela <ranier.vf@gmail.com>)
List 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 by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: Deparsing rewritten query
Next
From: Tom Lane
Date:
Subject: Re: Deparsing rewritten query