I've created a CF entry. I'm sorry it took so long. Life happened. https://commitfest.postgresql.org/patch/7082/
On Mon, Jul 13, 2026 at 11:36 PM Daniel Gustafsson <[email protected]> wrote: > > > Simply changing num_entries to int64 leads to the change of the file > > header format. I suggest changing num_entries to int64 in PG19 and > > later, because it wasn't released yet, and pgss files generated by > > another major version are considered to be incompatible anyway. See > > the v1 patch attached. > > Agreed, I think we should make sure to do this once beta2 has shipped for the > next beta release. > Daniel, please feel free to become a reviewer and move it to RfC if you like the patch. I'm not sure how CFBot works. It's failing to apply the patch, and I believe it's because I sent two alternative patches in one mail. So I'm resending one patch this time, hoping it will work. Best regards, Karina Litskevich Postgres Professional: http://postgrespro.com/
From c2b6bd266c5f706c23317c25923ab9cbe7f8ef10 Mon Sep 17 00:00:00 2001 From: Karina Litskevich <[email protected]> Date: Mon, 13 Jul 2026 15:44:07 +0300 Subject: [PATCH v1] Use int64 for number of entries in pg_stat_statements In 13b935cd hash_get_num_entries was changed to return int64. Clean up one of its usages in pg_stat_statements that was missed. Don't bother to change PGSS_FILE_HEADER, since the file header format is only to be changed in not yet released major versions. Also fix the definition of pgver according to its usage while we are here. --- contrib/pg_stat_statements/pg_stat_statements.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index 92315627916..6c6c09e9968 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -533,9 +533,9 @@ pgss_shmem_init(void *arg) FILE *file = NULL; FILE *qfile = NULL; uint32 header; - int32 num; - int32 pgver; - int32 i; + int64 num; + uint32 pgver; + int64 i; int buffer_size; char *buffer = NULL; @@ -612,7 +612,7 @@ pgss_shmem_init(void *arg) if (fread(&header, sizeof(uint32), 1, file) != 1 || fread(&pgver, sizeof(uint32), 1, file) != 1 || - fread(&num, sizeof(int32), 1, file) != 1) + fread(&num, sizeof(int64), 1, file) != 1) goto read_error; if (header != PGSS_FILE_HEADER || @@ -737,7 +737,7 @@ pgss_shmem_shutdown(int code, Datum arg) char *qbuffer = NULL; Size qbuffer_size = 0; HASH_SEQ_STATUS hash_seq; - int32 num_entries; + int64 num_entries; pgssEntry *entry; /* Don't try to dump during a crash. */ @@ -761,7 +761,7 @@ pgss_shmem_shutdown(int code, Datum arg) if (fwrite(&PGSS_PG_MAJOR_VERSION, sizeof(uint32), 1, file) != 1) goto error; num_entries = hash_get_num_entries(pgss_hash); - if (fwrite(&num_entries, sizeof(int32), 1, file) != 1) + if (fwrite(&num_entries, sizeof(int64), 1, file) != 1) goto error; qbuffer = qtext_load_file(&qbuffer_size); -- 2.51.0
