From 6e81fb936680797368272ebdee9dbfbbb41e257a Mon Sep 17 00:00:00 2001 From: Maksim Melnikov Date: Fri, 30 Jan 2026 11:27:24 +0300 Subject: [PATCH] pg_query_state code should be stable to the struct LOCKTAG extension. LOCKTAG is used in hash calculations, so if new field is added to LOCKTAG and this field is not initialized in pg_query_state internals, as the result, the hashcode of LOCKTAG will have different values for two independent calculations. --- pg_query_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pg_query_state.c b/pg_query_state.c index 739a44e..a5e6fb9 100644 --- a/pg_query_state.c +++ b/pg_query_state.c @@ -419,6 +419,7 @@ void LockShmem(LOCKTAG *tag, uint32 key) { LockAcquireResult result; + memset(tag, 0, sizeof(LOCKTAG)); tag->locktag_field1 = PG_QS_MODULE_KEY; tag->locktag_field2 = key; tag->locktag_field3 = 0;