Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxUwq-0006Q1-SD for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Jun 2021 13:35:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lxUwp-00089k-JG for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Jun 2021 13:35:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxUwp-00089b-9W for pgsql-hackers@lists.postgresql.org; Sun, 27 Jun 2021 13:35:43 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lxUwk-0001ip-Fu for pgsql-hackers@postgresql.org; Sun, 27 Jun 2021 13:35:42 +0000 Received: by mail-pj1-x1033.google.com with SMTP id 22-20020a17090a0c16b0290164a5354ad0so11023635pjs.2 for ; Sun, 27 Jun 2021 06:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JCFMkkSA8JriHA+BUUcExZTU2CU2NSwJLjAiT4eQuEE=; b=VNryTrh2RSDsVrECSiiK5/86RytwZrxMiQDXzkw3/8YUDkaJIZLLCByKwSaTrdfiP+ 3nhhs65myA5xbiAFZykFigMlw9/gN+4jL2mG0By1YZT+OAaq6BCLVJtjUakScJXW90Js 897rLpla4fwDRuljogzjKBZpvIASrHOGglNt/8T7Ye9VY1BrxpkIVwn2K8QFzjnjvF41 pXExZyUi2cbuPunNaleFvIwzySpeQajowkut9vOI0nJpf/Z3zXyGM2BaWtHNlUnVK3K0 0Nj5Gpg+eyQXrddUj/iqFfBpDGICmo2KZb2vQS60D3RLGXIwPNzIvxWcK6RXLg9kkRuz RJXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JCFMkkSA8JriHA+BUUcExZTU2CU2NSwJLjAiT4eQuEE=; b=Trp/RrUgxdkMgksRA4IArE6mQ6cW/8Ls2tqw5GuZcSxKeFS97OJMZPnEfT6iFiqyHk zfkdaAlkwW8rBV+KaqG/Fa5pG5zMqgNUJP01u4dTCxprhr3+OJmf2DqaN5fg/30+/irZ ImBNWyI6o6/7ilFm3oU85jv4vOh3h4obpI5OMd0pyBmlImTU94CD96z/LOH/NCpSbjJ2 ZErDOoS066WsZ+xIh2CofojZ3IiPsBLnFDLNnwUHblB1CI420/f73DgZZH3/gQ9Ek9it esrNgmz9vgdm5p1gaoc2vKqeOmWqnqzDz3/Zr0dnj6CkNoAk8YHW5nx/evxpdArcmtBl OnHg== X-Gm-Message-State: AOAM53279ic2ioxerSJFCa4dt2PJaOhJrCfHpg9A3idG6pW9ZL247Sb/ X4XEtPgzk+U285bD+sG31O4= X-Google-Smtp-Source: ABdhPJy+Xol7CQAJzO/fw1c0EtGSoktysZlOb01P4mxnqzZw5QVMcrRbJlT0Nua32krvMkb4PxLMwQ== X-Received: by 2002:a17:90a:ea18:: with SMTP id w24mr22255416pjy.126.1624800935769; Sun, 27 Jun 2021 06:35:35 -0700 (PDT) Received: from nol (2001-b011-0001-721f-1649-3133-8a3e-8398.dynamic-ip6.hinet.net. [2001:b011:1:721f:1649:3133:8a3e:8398]) by smtp.gmail.com with ESMTPSA id y1sm11332559pfe.72.2021.06.27.06.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 06:35:35 -0700 (PDT) Date: Sun, 27 Jun 2021 21:35:35 +0800 From: Julien Rouhaud To: Ranier Vilela Cc: Pg Hackers , Pavel Stehule Subject: Re: Deparsing rewritten query Message-ID: <20210627133535.hsuf6jwmacmktpnj@nol> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.