pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Subject: Re: Deparsing rewritten query
Date: Sun, 27 Jun 2021 21:35:35 +0800
Message-ID: <20210627133535.hsuf6jwmacmktpnj@nol> (raw)
In-Reply-To: <CAEudQAp1kX+G_uG3ZfyCDsdff4ue-vmwbWQzRwWb4oPYOFpunA@mail.gmail.com>
References: <CAEudQAp1kX+G_uG3ZfyCDsdff4ue-vmwbWQzRwWb4oPYOFpunA@mail.gmail.com>

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.





view thread (24+ messages)  latest in thread

Message-ID: <20210627133535.hsuf6jwmacmktpnj@nol>
Permalink:  ../20210627133535.hsuf6jwmacmktpnj@nol/
Also on:    postgresql.org/message-id/20210627133535.hsuf6jwmacmktpnj@nol

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: rjuju123@gmail.com, ranier.vf@gmail.com, pavel.stehule@gmail.com
  Subject: Re: Deparsing rewritten query
  In-Reply-To: <20210627133535.hsuf6jwmacmktpnj@nol>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox