int64 support in List API

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: int64 support in List API
Date: 2025-01-20 04:01:27
Message-ID: CABwTF4VniZ6Nwr-WvoHzF9BHNYcC=3HUjw515SFnWivziMf_Fw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I was working on an extension [1] that needed to manage a list of query IDs.
Query ID is internally of type uint64 (struct Query's member named queryId),
but it is exposed to the SQL layer as signed int64 (e.g
pg_stat_activity.query_id is of type bigint).

I wanted to use the list api from pg_list.h. It has special implementations for
int, oid, pointer, and xid types, which help with lower code overhead (no need
to create structures whose sole member is of one of these types) and better
performance. So I was wondering if there's any interest in having a similar API
for int64 type, as well. I am not sure if there are any candidates in Postgres
core that'd benefit from this, but it sure would've helped when I was
developing the extension.

Please see attached a minimal patch that I developed while developing my
extension. By no means is the patch complete, but if there's interest in list
API for int64 type, I can complete the patch and make the new API match the
current API for int type.

[1]: pg_block_queries
https://github.com/gurjeet/pg_block_queries/

Best regards,
Gurjeet
http://Gurje.et

Attachment Content-Type Size
int64_list_api.patch application/octet-stream 6.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2025-01-20 04:10:41 Re: Pgoutput not capturing the generated columns
Previous Message Amit Kapila 2025-01-20 03:52:48 Re: Skip collecting decoded changes of already-aborted transactions