From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Minor additional improvements for ecpglib/prepare.c.
Date: Wed, 17 Oct 2018 18:22:36 +0000
Message-ID: <E1gCqSq-0005zt-UK@gemulon.postgresql.org> (raw)
Minor additional improvements for ecpglib/prepare.c.
Avoid allocating never-used entries in stmtCacheEntries[], other than the
intentionally-unused zero'th entry. Tie the array size directly to the
bucket count and size, rather than having undocumented dependencies between
three magic constants. Fix the hash calculation to be platform-independent
--- notably, it was sensitive to the signed'ness of "char" before, not to
mention having an unnecessary hard-wired dependency on the existence and
size of type "long long". (The lack of complaints says it's been a long
time since anybody tried to build PG on a compiler without "long long",
and certainly with the requirement for C99 this isn't a live bug anymore.
But it's still not per project coding style.) Fix ecpg_auto_prepare's
new-cache-entry path so that it increments the exec count for the new
cache entry not the dummy zero'th entry.
The last of those is an actual bug, though one of little consequence;
the rest is mostly future-proofing and neatnik-ism. Doesn't seem
necessary to back-patch.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d8cc1616b5547d49d899be7b68713272ce334708
Modified Files
--------------
src/interfaces/ecpg/ecpglib/prepare.c | 33 ++++++++++++++--------
.../ecpg/test/expected/preproc-autoprep.stderr | 10 +++----
2 files changed, 27 insertions(+), 16 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Minor additional improvements for ecpglib/prepare.c.
In-Reply-To: <E1gCqSq-0005zt-UK@gemulon.postgresql.org>
References: <E1gCqSq-0005zt-UK@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