Skip to content

Commit 2959213

Browse files
committed
pg_stat_statements: Add a comment about the dangers of padding bytes.
Inspired by a patch from Julien Rouhaud, but I reworded it. Discussion: http://postgr.es/m/CAOBaU_a8AH8=ypfqgHnDYu06ts+jWTUgh=VgCxA3yNV-K10j9w@mail.gmail.com
1 parent e250c8c commit 2959213

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ typedef enum pgssVersion
125125
/*
126126
* Hashtable key that defines the identity of a hashtable entry. We separate
127127
* queries by user and by database even if they are otherwise identical.
128+
*
129+
* Right now, this structure contains no padding. If you add any, make sure
130+
* to teach pgss_store() to zero the padding bytes. Otherwise, things will
131+
* break, because pgss_hash is created using HASH_BLOBS, and thus tag_hash
132+
* is used to hash this.
128133
*/
129134
typedef struct pgssHashKey
130135
{

0 commit comments

Comments
 (0)