Add an assert to the length of shared hashtable name

From: Xiaoran Wang <wxiaoran(at)vmware(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Add an assert to the length of shared hashtable name
Date: 2022-09-26 05:08:48
Message-ID: SN6PR05MB44626B969DC352BD24370915BA529@SN6PR05MB4462.namprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The max size for the shared memory hash table name is SHMEM_INDEX_KEYSIZE - 1
(shared hash table name is stored and indexed by ShmemIndex hash table,
the key size of it is SHMEM_INDEX_KEYSIZE), but when the caller uses a
longer hash table name, it doesn't report any error, instead it just
uses the first SHMEM_INDEX_KEYSIZE chars as the hash table name.

When some hash tables' names have the same prefix which is longer than
(SHMEM_INDEX_KEYSIZE - 1), issues will come: those hash tables actually
are created as the same hash table whose name is the prefix. So add the
assert to prevent it.

Attachment Content-Type Size
fix_shmem_hash_table_name_length.patch application/octet-stream 473 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message bt22nakamorit 2022-09-26 06:12:46 Differentiate MERGE queries with different structures
Previous Message wangw.fnst@fujitsu.com 2022-09-26 04:44:00 RE: Data is copied twice when specifying both child and parent table in publication