pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clarify comment for worst-case allocation in quote_literal_cstr(
Date: Mon, 07 Apr 2025 01:16:03 +0000
Message-ID: <E1u1b5n-0032fb-0c@gemulon.postgresql.org> (raw)

Clarify comment for worst-case allocation in quote_literal_cstr()

palloc() is invoked with a specific formula for its allocation size in
quote_literal_cstr().  This wastes some memory, but the size is large
enough to cover even the worst-case scenarios.

No explanations were given about the reasons behind these numbers.  This
commit adds more documentation about all that.

Author: Steve Chavez <steve@supabase.io>
Discussion: https://postgr.es/m/CAGRrpzZ9bToRWS+fAnjxDJrxwZN1QcJ-y1Pn2yg=Hst6rydLtw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c36eda259130faf3559b751b9e81a5c7e2bee0d7

Modified Files
--------------
src/backend/utils/adt/quote.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)



Message-ID: <E1u1b5n-0032fb-0c@gemulon.postgresql.org>
Permalink:  ../E1u1b5n-0032fb-0c@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1u1b5n-0032fb-0c@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Clarify comment for worst-case allocation in quote_literal_cstr(
  In-Reply-To: <E1u1b5n-0032fb-0c@gemulon.postgresql.org>

* 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