pgsql: Minor additional improvements for ecpglib/prepare.c. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Minor additional improvements for ecpglib/prepare.c.
Date
Msg-id E1gCqSq-0005zt-UK@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Improve tzparse's handling of TZDEFRULES ("posixrules") zonedat
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Fix crash in multi-insert COPY