Re: Should we represent temp files as unsigned long int instead of signed long int type? - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Should we represent temp files as unsigned long int instead of signed long int type?
Date
Msg-id ZTm1l12SJzUwQbpb@paquier.xyz
Whole thread Raw
In response to Re: Should we represent temp files as unsigned long int instead of signed long int type?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Should we represent temp files as unsigned long int instead of signed long int type?
List pgsql-hackers
On Wed, Oct 25, 2023 at 03:07:39PM -0400, Tom Lane wrote:
> AFAIK, nothing particularly awful will happen if that counter wraps
> around.  Perhaps if you gamed the system really hard, you could cause
> a collision with a still-extant temp file from the previous cycle,
> but I seriously doubt that could happen by accident.  So I don't
> think there's anything to worry about here.  Maybe we could make
> that filename pattern %lu not %ld, but minus sign is a perfectly
> acceptable filename character, so such a change would be cosmetic.

In the mood of removing long because it may be 4 bytes or 8 bytes
depending on the environment, I'd suggest to change it to either int64
or uint64.  Not that it matters much for this specific case, but that
makes the code more portable.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Document aggregate functions better w.r.t. ORDER BY
Next
From: Tom Lane
Date:
Subject: Re: Should we represent temp files as unsigned long int instead of signed long int type?