SnapshotNow == (Snapshot) NULL, seems bad

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: SnapshotNow == (Snapshot) NULL, seems bad
Date: 2004-09-06 01:42:38
Message-ID: 3512.1094434958@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Reini Urban 2004-09-06 07:14:58 Re: APR 1.0 released
Previous Message Rod Taylor 2004-09-05 23:13:56 Re: AIX and v8 beta1