PG-228: Fix hash table creation flags on PG <= 13.
Before PostgreSQL 14, HASH_STRINGS flag was not available when creating a hash table with ShmemInitHash(). Use HASH_BLOBS for previous PostgreSQL versions.pull/157/head
parent
6f353a5596
commit
8ea02b0f2a
|
@ -47,6 +47,12 @@ static HTAB *pgsm_errors_ht = NULL;
|
||||||
void psgm_errors_init(void)
|
void psgm_errors_init(void)
|
||||||
{
|
{
|
||||||
HASHCTL info;
|
HASHCTL info;
|
||||||
|
#if PG_VERSION_NUM >= 140000
|
||||||
|
int flags = HASH_ELEM | HASH_STRINGS;
|
||||||
|
#else
|
||||||
|
int flags = HASH_ELEM | HASH_BLOBS;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.keysize = ERROR_MSG_MAX_LEN;
|
info.keysize = ERROR_MSG_MAX_LEN;
|
||||||
|
@ -55,7 +61,7 @@ void psgm_errors_init(void)
|
||||||
PSGM_ERRORS_MAX, /* initial size */
|
PSGM_ERRORS_MAX, /* initial size */
|
||||||
PSGM_ERRORS_MAX, /* maximum size */
|
PSGM_ERRORS_MAX, /* maximum size */
|
||||||
&info,
|
&info,
|
||||||
HASH_ELEM | HASH_STRINGS);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pgsm_errors_size(void)
|
size_t pgsm_errors_size(void)
|
||||||
|
|
Loading…
Reference in New Issue