Skip site navigation (1) Skip section navigation (2)

Moving core timestamp typedefs/macros somewhere else

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Moving core timestamp typedefs/macros somewhere else
Date: 2011-09-08 00:22:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
In connection with doing this:
I've run into the problem that tz_acceptable(), which needs to be
available to frontend-ish code if initdb is to use it, depends on these

#define UNIX_EPOCH_JDATE        2440588 /* == date2j(1970, 1, 1) */
#define POSTGRES_EPOCH_JDATE    2451545 /* == date2j(2000, 1, 1) */
#define SECS_PER_DAY 86400

which are defined in backend-only include files such as
utils/timestamp.h.  This immediately brought to mind the pgrminclude
fiasco of a couple days ago, which was at least in part due to the fact
that utils/timestamp.h got included into some very low-level header
files so that they could use typedef TimestampTz.  So I think it's time
to do something about that.

I propose moving the Timestamp/Interval typedefs, as well as some basic
associated macros such as the ones mentioned above (basically, lines
25-100 of utils/timestamp.h, plus the DT_NOBEGIN/DT_NOEND stuff, plus
the Julian-date macros in datetime.h), into a separate header file that
contains no backend-only declarations (eg, not fmgr.h stuff; right
offhand I don't think it would depend on anything except c.h).

If you believe the idea I suggested a few days ago that we ought to try
to push basic typedefs into a separate set of headers, then this could
be the first instance of that, which would lead to naming it something
like "datatype/timestamp.h".  If that seems premature, then I guess it
ought to go into utils/, but then we need some other name because
utils/timestamp.h is taken.


			regards, tom lane


pgsql-hackers by date

Next:From: Brendan JurdDate: 2011-09-08 00:35:11
Subject: Re: Moving core timestamp typedefs/macros somewhere else
Previous:From: Robert HaasDate: 2011-09-08 00:22:30
Subject: Re: [PATCH] Log crashed backend's query (activity string)

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group