SnapshotNow == (Snapshot) NULL, seems bad - Mailing list pgsql-hackers

From Tom Lane
Subject SnapshotNow == (Snapshot) NULL, seems bad
Date
Msg-id 3512.1094434958@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
With the current definitions of the "special" snapshot values:

#define SnapshotNow                  ((Snapshot) 0x0)
#define SnapshotSelf                 ((Snapshot) 0x1)
#define SnapshotAny                  ((Snapshot) 0x2)
#define SnapshotToast                ((Snapshot) 0x3)

it is not possible to distinguish SnapshotNow from (Snapshot) NULL,
and in particular there is no unique representation defined for an
"invalid" snapshot.  This has not caused problems to date, but it
seems inevitable that it will rise up and bite us someday.  Does
anyone object to revising these values to be 0x1-0x4 respectively,
and adding "InvalidSnapshot" #defined to 0?

This change would force a backend-wide recompile, and possibly force
recompiling some external C functions, but not have any wider effect
than that AFAICS.

I have an ulterior motive here, which is that in connection with
the discussions about changing SetQuerySnapshot behavior, I am looking
at some internal API changes for which it would be convenient to have
an InvalidSnapshot value ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: AIX and v8 beta1
Next
From: Reini Urban
Date:
Subject: Re: APR 1.0 released