pgsql: Minor additional improvements for ecpglib/prepare.c.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Minor additional improvements for ecpglib/prepare.c.
Дата
Msg-id E1gCqSq-0005zt-UK@gemulon.postgresql.org
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve tzparse's handling of TZDEFRULES ("posixrules") zonedat
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Fix crash in multi-insert COPY